1 <?php
2 /**
3 * @package FrameworkOnFramework
4 * @subpackage model
5 * @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
6 * @license GNU General Public License version 2 or later; see LICENSE.txt
7 */
8 // Protect from unauthorized access
9 defined('FOF_INCLUDED') or die;
10
11 /**
12 * FrameworkOnFramework model behavior class. It defines the events which are
13 * called by a Model.
14 *
15 * @codeCoverageIgnore
16 * @package FrameworkOnFramework
17 * @since 2.1
18 */
19 abstract class FOFModelBehavior extends FOFUtilsObservableEvent
20 {
21 /**
22 * This event runs before saving data in the model
23 *
24 * @param FOFModel &$model The model which calls this event
25 * @param array &$data The data to save
26 *
27 * @return void
28 */
29 public function onBeforeSave(&$model, &$data)
30 {
31 }
32
33 /**
34 * This event runs before deleting a record in a model
35 *
36 * @param FOFModel &$model The model which calls this event
37 *
38 * @return void
39 */
40 public function onBeforeDelete(&$model)
41 {
42 }
43
44 /**
45 * This event runs before copying a record in a model
46 *
47 * @param FOFModel &$model The model which calls this event
48 *
49 * @return void
50 */
51 public function onBeforeCopy(&$model)
52 {
53 }
54
55 /**
56 * This event runs before publishing a record in a model
57 *
58 * @param FOFModel &$model The model which calls this event
59 *
60 * @return void
61 */
62 public function onBeforePublish(&$model)
63 {
64 }
65
66 /**
67 * This event runs before registering a hit on a record in a model
68 *
69 * @param FOFModel &$model The model which calls this event
70 *
71 * @return void
72 */
73 public function onBeforeHit(&$model)
74 {
75 }
76
77 /**
78 * This event runs before moving a record in a model
79 *
80 * @param FOFModel &$model The model which calls this event
81 *
82 * @return void
83 */
84 public function onBeforeMove(&$model)
85 {
86 }
87
88 /**
89 * This event runs before changing the records' order in a model
90 *
91 * @param FOFModel &$model The model which calls this event
92 *
93 * @return void
94 */
95 public function onBeforeReorder(&$model)
96 {
97 }
98
99 /**
100 * This event runs when we are building the query used to fetch a record
101 * list in a model
102 *
103 * @param FOFModel &$model The model which calls this event
104 * @param FOFDatabaseQuery &$query The query being built
105 *
106 * @return void
107 */
108 public function onBeforeBuildQuery(&$model, &$query)
109 {
110 }
111
112 /**
113 * This event runs after saving a record in a model
114 *
115 * @param FOFModel &$model The model which calls this event
116 *
117 * @return void
118 */
119 public function onAfterSave(&$model)
120 {
121 }
122
123 /**
124 * This event runs after deleting a record in a model
125 *
126 * @param FOFModel &$model The model which calls this event
127 *
128 * @return void
129 */
130 public function onAfterDelete(&$model)
131 {
132 }
133
134 /**
135 * This event runs after copying a record in a model
136 *
137 * @param FOFModel &$model The model which calls this event
138 *
139 * @return void
140 */
141 public function onAfterCopy(&$model)
142 {
143 }
144
145 /**
146 * This event runs after publishing a record in a model
147 *
148 * @param FOFModel &$model The model which calls this event
149 *
150 * @return void
151 */
152 public function onAfterPublish(&$model)
153 {
154 }
155
156 /**
157 * This event runs after registering a hit on a record in a model
158 *
159 * @param FOFModel &$model The model which calls this event
160 *
161 * @return void
162 */
163 public function onAfterHit(&$model)
164 {
165 }
166
167 /**
168 * This event runs after moving a record in a model
169 *
170 * @param FOFModel &$model The model which calls this event
171 *
172 * @return void
173 */
174 public function onAfterMove(&$model)
175 {
176 }
177
178 /**
179 * This event runs after reordering records in a model
180 *
181 * @param FOFModel &$model The model which calls this event
182 *
183 * @return void
184 */
185 public function onAfterReorder(&$model)
186 {
187 }
188
189 /**
190 * This event runs after we have built the query used to fetch a record
191 * list in a model
192 *
193 * @param FOFModel &$model The model which calls this event
194 * @param FOFDatabaseQuery &$query The query being built
195 *
196 * @return void
197 */
198 public function onAfterBuildQuery(&$model, &$query)
199 {
200 }
201
202 /**
203 * This event runs after getting a single item
204 *
205 * @param FOFModel &$model The model which calls this event
206 * @param FOFTable &$record The record loaded by this model
207 *
208 * @return void
209 */
210 public function onAfterGetItem(&$model, &$record)
211 {
212 }
213 }
214