1 | <?php |
||
13 | abstract class Model extends CachedModel |
||
14 | { |
||
15 | /** |
||
16 | * Generates a string with the object's type and ID |
||
17 | */ |
||
18 | public function __toString() |
||
22 | |||
23 | /** |
||
24 | * Find if the model is in the trash can (or doesn't exist) |
||
25 | * |
||
26 | * @return bool True if the model has been deleted |
||
27 | */ |
||
28 | public function isDeleted() |
||
36 | |||
37 | /** |
||
38 | * Find if the model is active (i.e. visible to everyone) |
||
39 | * |
||
40 | * @return bool |
||
41 | */ |
||
42 | public function isActive() |
||
52 | |||
53 | /** |
||
54 | * Get the models's status |
||
55 | * |
||
56 | * @deprecated 0.11.0 Use isDeleted() for checking for deleted models instead. |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | public function getStatus() |
||
70 | |||
71 | /** |
||
72 | * Find if two objects represent the same model |
||
73 | * |
||
74 | * @param object $model The model to compare |
||
75 | * @return bool |
||
76 | */ |
||
77 | public function isSameAs($model) |
||
91 | |||
92 | /** |
||
93 | * Get the possible statuses representing an active model (visible to everyone) |
||
94 | * |
||
95 | * @return string[] |
||
96 | */ |
||
97 | public static function getActiveStatuses() |
||
101 | |||
102 | /** |
||
103 | * Converts an array of IDs to an array of Models |
||
104 | * @param int[] $idArray The list of IDs |
||
105 | * @return static[] An array of models |
||
106 | */ |
||
107 | public static function arrayIdToModel($idArray) |
||
116 | |||
117 | /** |
||
118 | * Converts an array of Models to an array of IDs |
||
119 | * |
||
120 | * All model type information is lost |
||
121 | * |
||
122 | * @param ModelInterface[] $modelArray The list of models |
||
123 | * @return int[] An array of IDs |
||
124 | */ |
||
125 | public static function mapToIDs($modelArray) |
||
131 | |||
132 | /** |
||
133 | * Update a property and the corresponding database column |
||
134 | * |
||
135 | * @param mixed $property The protected class property to update |
||
136 | * @param string $dbColumn The name of the database column to update |
||
137 | * @param mixed $value The value to insert |
||
138 | * @param string $type The mysqli type of the value (s, i, d, b) |
||
139 | * |
||
140 | * @return static Returns the model itself to allow method chaining |
||
141 | */ |
||
142 | protected function updateProperty(&$property, $dbColumn, $value, $type = 'i') |
||
157 | |||
158 | /** |
||
159 | * Gets the type of the model |
||
160 | * @return string The type of the model, e.g. "server" |
||
161 | */ |
||
162 | public static function getType() |
||
166 | |||
167 | /** |
||
168 | * Gets a human-readable format of the model's type |
||
169 | * @return string |
||
170 | */ |
||
171 | public static function getTypeForHumans() |
||
175 | |||
176 | /** |
||
177 | * Change a parameter if a model is not valid |
||
178 | * |
||
179 | * Useful for form validation |
||
180 | * |
||
181 | * @param string $property The name of the property to change |
||
182 | * @param mixed $value The value of the property |
||
183 | * @return self |
||
184 | */ |
||
185 | protected function inject($property, $value) |
||
193 | |||
194 | /** |
||
195 | * Takes a CamelCase string and converts it to a snake_case one |
||
196 | * @param string $input The string to convert |
||
197 | * @return string |
||
198 | */ |
||
199 | private static function toSnakeCase($input) |
||
210 | |||
211 | /** |
||
212 | * Escape special HTML characters from a string |
||
213 | * @param string $string |
||
214 | * @return string |
||
215 | */ |
||
216 | public static function escape($string) |
||
220 | |||
221 | /** |
||
222 | * Create a single model object from a database result |
||
223 | * |
||
224 | * @param array $result The MySQL row of the model |
||
225 | * |
||
226 | * @return static |
||
227 | */ |
||
228 | public static function createFromDatabaseResult(&$result) |
||
235 | |||
236 | /** |
||
237 | * Create model objects, given their MySQL entries |
||
238 | * |
||
239 | * @param array $results The MySQL rows of the model |
||
240 | * @return static[] |
||
241 | */ |
||
242 | public static function createFromDatabaseResults(&$results) |
||
252 | } |
||
253 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.