Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
observer.php
Aller à la documentation de ce fichier.
1 <?php
2 /**
3  * @package Joomla.Platform
4  * @subpackage Table
5  *
6  * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
7  * @license GNU General Public License version 2 or later; see LICENSE
8  */
9 
10 defined('JPATH_PLATFORM') or die;
11 
12 /**
13  * Table class supporting modified pre-order tree traversal behavior.
14  *
15  * @package Joomla.Platform
16  * @subpackage Table
17  * @link http://docs.joomla.org/JTableObserver
18  * @since 3.1.2
19  */
20 abstract class JTableObserver implements JObserverInterface
21 {
22  /**
23  * The observed table
24  *
25  * @var JTable
26  * @since 3.1.2
27  */
28  protected $table;
29 
30  /**
31  * Constructor: Associates to $table $this observer
32  *
33  * @param JTable $table Table to be observed
34  *
35  * @since 3.1.2
36  */
37  public function __construct(JTable $table)
38  {
39  $table->attachObserver($this);
40  $this->table = $table;
41  }
42 
43  /**
44  * Pre-processor for $table->load($keys, $reset)
45  *
46  * @param mixed $keys An optional primary key value to load the row by, or an array of fields to match. If not
47  * set the instance property value is used.
48  * @param boolean $reset True to reset the default values before loading the new row.
49  *
50  * @return void
51  *
52  * @since 3.1.2
53  */
54  public function onBeforeLoad($keys, $reset)
55  {
56  }
57 
58  /**
59  * Post-processor for $table->load($keys, $reset)
60  *
61  * @param boolean &$result The result of the load
62  * @param array $row The loaded (and already binded to $this->table) row of the database table
63  *
64  * @return void
65  *
66  * @since 3.1.2
67  */
68  public function onAfterLoad(&$result, $row)
69  {
70  }
71 
72  /**
73  * Pre-processor for $table->store($updateNulls)
74  *
75  * @param boolean $updateNulls The result of the load
76  * @param string $tableKey The key of the table
77  *
78  * @return void
79  *
80  * @since 3.1.2
81  */
82  public function onBeforeStore($updateNulls, $tableKey)
83  {
84  }
85 
86  /**
87  * Post-processor for $table->store($updateNulls)
88  *
89  * @param boolean &$result The result of the store
90  *
91  * @return void
92  *
93  * @since 3.1.2
94  */
95  public function onAfterStore(&$result)
96  {
97  }
98 
99  /**
100  * Pre-processor for $table->delete($pk)
101  *
102  * @param mixed $pk An optional primary key value to delete. If not set the instance property value is used.
103  *
104  * @return void
105  *
106  * @since 3.1.2
107  * @throws UnexpectedValueException
108  */
109  public function onBeforeDelete($pk)
110  {
111  }
112 
113  /**
114  * Post-processor for $table->delete($pk)
115  *
116  * @param mixed $pk The deleted primary key value.
117  *
118  * @return void
119  *
120  * @since 3.1.2
121  */
122  public function onAfterDelete($pk)
123  {
124  }
125 }