From d1a530f53b9c89f95b4f979f9f862eb2495d2ed6 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Sat, 15 Oct 2011 12:34:31 -0430 Subject: [PATCH] Fixing all @link annotations in model class --- lib/Cake/Model/Behavior/TranslateBehavior.php | 2 +- lib/Cake/Model/Behavior/TreeBehavior.php | 25 +++---- lib/Cake/Model/Model.php | 73 +++++++++---------- 3 files changed, 49 insertions(+), 51 deletions(-) diff --git a/lib/Cake/Model/Behavior/TranslateBehavior.php b/lib/Cake/Model/Behavior/TranslateBehavior.php index a346c900d..d36572ebc 100644 --- a/lib/Cake/Model/Behavior/TranslateBehavior.php +++ b/lib/Cake/Model/Behavior/TranslateBehavior.php @@ -23,7 +23,7 @@ App::uses('I18n', 'I18n'); * Translate behavior * * @package Cake.Model.Behavior - * @link http://book.cakephp.org/view/1328/Translate + * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/translate.html */ class TranslateBehavior extends ModelBehavior { diff --git a/lib/Cake/Model/Behavior/TreeBehavior.php b/lib/Cake/Model/Behavior/TreeBehavior.php index 6e0875458..dc1aa8cf3 100644 --- a/lib/Cake/Model/Behavior/TreeBehavior.php +++ b/lib/Cake/Model/Behavior/TreeBehavior.php @@ -26,7 +26,7 @@ * * @see http://en.wikipedia.org/wiki/Tree_traversal * @package Cake.Model.Behavior - * @link http://book.cakephp.org/view/1339/Tree + * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html */ class TreeBehavior extends ModelBehavior { @@ -200,7 +200,7 @@ class TreeBehavior extends ModelBehavior { * @param mixed $id The ID of the record to read or false to read all top level nodes * @param boolean $direct whether to count direct, or all, children * @return integer number of child nodes - * @link http://book.cakephp.org/view/1347/Counting-children + * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::childCount */ public function childCount($Model, $id = null, $direct = false) { if (is_array($id)) { @@ -246,7 +246,7 @@ class TreeBehavior extends ModelBehavior { * @param integer $page Page number, for accessing paged data * @param integer $recursive The number of levels deep to fetch associated records * @return array Array of child nodes - * @link http://book.cakephp.org/view/1346/Children + * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::children */ public function children($Model, $id = null, $direct = false, $fields = null, $order = null, $limit = null, $page = 1, $recursive = null) { if (is_array($id)) { @@ -303,7 +303,7 @@ class TreeBehavior extends ModelBehavior { * @param string $spacer The character or characters which will be repeated * @param integer $recursive The number of levels deep to fetch associated records * @return array An associative array of records, where the id is the key, and the display field is the value - * @link http://book.cakephp.org/view/1348/generatetreelist + * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::generateTreeList */ public function generateTreeList($Model, $conditions = null, $keyPath = null, $valuePath = null, $spacer = '_', $recursive = null) { $overrideRecursive = $recursive; @@ -359,7 +359,7 @@ class TreeBehavior extends ModelBehavior { * @param string|array $fields * @param integer $recursive The number of levels deep to fetch associated records * @return array|boolean Array of data for the parent node - * @link http://book.cakephp.org/view/1349/getparentnode + * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::getParentNode */ public function getParentNode($Model, $id = null, $fields = null, $recursive = null) { if (is_array($id)) { @@ -392,7 +392,7 @@ class TreeBehavior extends ModelBehavior { * @param mixed $fields Either a single string of a field name, or an array of field names * @param integer $recursive The number of levels deep to fetch associated records * @return array Array of nodes from top most parent to current node - * @link http://book.cakephp.org/view/1350/getpath + * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::getPath */ public function getPath($Model, $id = null, $fields = null, $recursive = null) { if (is_array($id)) { @@ -429,7 +429,7 @@ class TreeBehavior extends ModelBehavior { * @param mixed $id The ID of the record to move * @param integer|boolean $number how many places to move the node or true to move to last position * @return boolean true on success, false on failure - * @link http://book.cakephp.org/view/1352/moveDown + * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::moveDown */ public function moveDown($Model, $id = null, $number = 1) { if (is_array($id)) { @@ -487,7 +487,7 @@ class TreeBehavior extends ModelBehavior { * @param mixed $id The ID of the record to move * @param integer|boolean $number how many places to move the node, or true to move to first position * @return boolean true on success, false on failure - * @link http://book.cakephp.org/view/1353/moveUp + * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::moveUp */ public function moveUp($Model, $id = null, $number = 1) { if (is_array($id)) { @@ -551,7 +551,7 @@ class TreeBehavior extends ModelBehavior { * @param mixed $missingParentAction 'return' to do nothing and return, 'delete' to * delete, or the id of the parent to set as the parent_id * @return boolean true on success, false on failure - * @link http://book.cakephp.org/view/1628/Recover + * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::recover */ public function recover($Model, $mode = 'parent', $missingParentAction = null) { if (is_array($mode)) { @@ -630,8 +630,7 @@ class TreeBehavior extends ModelBehavior { * @param Model $Model Model instance * @param array $options array of options to use in reordering. * @return boolean true on success, false on failure - * @link http://book.cakephp.org/view/1355/reorder - * @link http://book.cakephp.org/view/1629/Reorder + * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::reorder */ public function reorder($Model, $options = array()) { $options = array_merge(array('id' => null, 'field' => $Model->displayField, 'order' => 'ASC', 'verify' => true), $options); @@ -670,7 +669,7 @@ class TreeBehavior extends ModelBehavior { * @param mixed $id The ID of the record to remove * @param boolean $delete whether to delete the node after reparenting children (if any) * @return boolean true on success, false on failure - * @link http://book.cakephp.org/view/1354/removeFromTree + * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::removeFromTree */ public function removeFromTree($Model, $id = null, $delete = false) { if (is_array($id)) { @@ -741,7 +740,7 @@ class TreeBehavior extends ModelBehavior { * @param Model $Model Model instance * @return mixed true if the tree is valid or empty, otherwise an array of (error type [index, node], * [incorrect left/right index,node id], message) - * @link http://book.cakephp.org/view/1630/Verify + * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::verify */ public function verify($Model) { extract($this->settings[$Model->alias]); diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 00492be32..3d5966de7 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -39,7 +39,7 @@ App::uses('Xml', 'Utility'); * The table is required to have at least 'id auto_increment' primary key. * * @package Cake.Model - * @link http://book.cakephp.org/view/1000/Models + * @link http://book.cakephp.org/2.0/en/models.html */ class Model extends Object { @@ -50,7 +50,7 @@ class Model extends Object { * or created using `ConnectionManager::create()`. * * @var string - * @link http://book.cakephp.org/view/1057/Model-Attributes#useDbConfig-1058 + * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#usedbconfig */ public $useDbConfig = 'default'; @@ -58,7 +58,7 @@ class Model extends Object { * Custom database table name, or null/false if no table association is desired. * * @var string - * @link http://book.cakephp.org/view/1057/Model-Attributes#useTable-1059 + * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#useTable */ public $useTable = null; @@ -68,7 +68,7 @@ class Model extends Object { * This field is also used in `find('list')` when called with no extra parameters in the fields list * * @var string - * @link http://book.cakephp.org/view/1057/Model-Attributes#displayField-1062 + * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#displayField */ public $displayField = null; @@ -84,7 +84,7 @@ class Model extends Object { * Container for the data that this model gets from persistent storage (usually, a database). * * @var array - * @link http://book.cakephp.org/view/1057/Model-Attributes#data-1065 + * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#data */ public $data = array(); @@ -99,7 +99,7 @@ class Model extends Object { * The name of the primary key field for this model. * * @var string - * @link http://book.cakephp.org/view/1057/Model-Attributes#primaryKey-1061 + * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#primaryKey */ public $primaryKey = null; @@ -107,7 +107,6 @@ class Model extends Object { * Field-by-field table metadata. * * @var array - * @link http://book.cakephp.org/view/1057/Model-Attributes#_schema-1066 */ protected $_schema = null; @@ -199,8 +198,8 @@ class Model extends Object { * - `on`: Possible values: `update`, `create`. Indicate to apply this rule only on update or create * * @var array - * @link http://book.cakephp.org/view/1057/Model-Attributes#validate-1067 - * @link http://book.cakephp.org/view/1143/Data-Validation + * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#validate + * @link http://book.cakephp.org/2.0/en/models/data-validation.html */ public $validate = array(); @@ -208,7 +207,6 @@ class Model extends Object { * List of validation errors. * * @var array - * @link http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller */ public $validationErrors = array(); @@ -224,7 +222,7 @@ class Model extends Object { * Database table prefix for tables in model. * * @var string - * @link http://book.cakephp.org/view/1057/Model-Attributes#tablePrefix-1060 + * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#tableprefix */ public $tablePrefix = null; @@ -232,7 +230,7 @@ class Model extends Object { * Name of the model. * * @var string - * @link http://book.cakephp.org/view/1057/Model-Attributes#name-1068 + * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#name */ public $name = null; @@ -255,7 +253,7 @@ class Model extends Object { * caching only, the results are not stored beyond the current request. * * @var boolean - * @link http://book.cakephp.org/view/1057/Model-Attributes#cacheQueries-1069 + * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#cacheQueries */ public $cacheQueries = false; @@ -302,7 +300,7 @@ class Model extends Object { * - `counterScope`: Optional conditions array to use for updating counter cache field. * * @var array - * @link http://book.cakephp.org/view/1042/belongsTo + * @link http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#belongsto */ public $belongsTo = array(); @@ -345,7 +343,7 @@ class Model extends Object { * User will also delete her associated Profile. * * @var array - * @link http://book.cakephp.org/view/1041/hasOne + * @link http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#hasone */ public $hasOne = array(); @@ -394,7 +392,7 @@ class Model extends Object { * records. This should be used in situations that require very custom results. * * @var array - * @link http://book.cakephp.org/view/1043/hasMany + * @link http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#hasmany */ public $hasMany = array(); @@ -454,7 +452,7 @@ class Model extends Object { * be used in situations that require very custom results. * * @var array - * @link http://book.cakephp.org/view/1044/hasAndBelongsToMany-HABTM + * @link http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#hasandbelongstomany-habtm */ public $hasAndBelongsToMany = array(); @@ -465,7 +463,7 @@ class Model extends Object { * public $actsAs = array('Translate', 'MyBehavior' => array('setting1' => 'value1')) * * @var array - * @link http://book.cakephp.org/view/1072/Using-Behaviors + * @link http://book.cakephp.org/2.0/en/models/behaviors.html#using-behaviors */ public $actsAs = null; @@ -502,7 +500,7 @@ class Model extends Object { * the first level by default. * * @var integer - * @link http://book.cakephp.org/view/1057/Model-Attributes#recursive-1063 + * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#recursive */ public $recursive = 1; @@ -513,7 +511,7 @@ class Model extends Object { * public $order = array("Post.view_count DESC", "Post.rating DESC"); * * @var string - * @link http://book.cakephp.org/view/1057/Model-Attributes#order-1064 + * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#order */ public $order = null; @@ -527,6 +525,7 @@ class Model extends Object { * Is a simplistic example of how to set virtualFields * * @var array + * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#virtualfields */ public $virtualFields = array(); @@ -822,7 +821,7 @@ class Model extends Object { * @param array $params Set of bindings (indexed by binding type) * @param boolean $reset Set to false to make the binding permanent * @return boolean Success - * @link http://book.cakephp.org/view/1045/Creating-and-Destroying-Associations-on-the-Fly + * @link http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#creating-and-destroying-associations-on-the-fly */ public function bindModel($params, $reset = true) { foreach ($params as $assoc => $model) { @@ -866,7 +865,7 @@ class Model extends Object { * @param array $params Set of bindings to unbind (indexed by binding type) * @param boolean $reset Set to false to make the unbinding permanent * @return boolean Success - * @link http://book.cakephp.org/view/1045/Creating-and-Destroying-Associations-on-the-Fly + * @link http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#creating-and-destroying-associations-on-the-fly */ public function unbindModel($params, $reset = true) { foreach ($params as $assoc => $models) { @@ -1052,7 +1051,7 @@ class Model extends Object { * @param mixed $one Array or string of data * @param string $two Value string for the alternative indata method * @return array Data with all of $one's keys and values - * @link http://book.cakephp.org/view/1031/Saving-Your-Data + * @link http://book.cakephp.org/2.0/en/models/saving-your-data.html */ public function set($one, $two = null) { if (!$one) { @@ -1368,7 +1367,7 @@ class Model extends Object { * schema data defaults are not merged. * @param boolean $filterKey If true, overwrites any primary key input with an empty value * @return array The current Model::data; after merging $data and/or defaults from database - * @link http://book.cakephp.org/view/1031/Saving-Your-Data + * @link http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-create-array-data-array */ public function create($data = array(), $filterKey = false) { $defaults = array(); @@ -1398,7 +1397,7 @@ class Model extends Object { * @param mixed $fields String of single fieldname, or an array of fieldnames. * @param mixed $id The ID of the record to read * @return array Array of database fields, or false if not found - * @link http://book.cakephp.org/view/1017/Retrieving-Your-Data#read-1029 + * @link http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#model-read */ public function read($fields = null, $id = null) { $this->validationErrors = array(); @@ -1432,7 +1431,7 @@ class Model extends Object { * @param array $conditions SQL conditions (defaults to NULL) * @param string $order SQL ORDER BY fragment * @return string field contents, or false if not found - * @link http://book.cakephp.org/view/1017/Retrieving-Your-Data#field-1028 + * @link http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#model-field */ public function field($name, $conditions = null, $order = null) { if ($conditions === null && $this->id !== false) { @@ -1472,7 +1471,7 @@ class Model extends Object { * @param array $validate See $options param in Model::save(). Does not respect 'fieldList' key if passed * @return boolean See Model::save() * @see Model::save() - * @link http://book.cakephp.org/view/1031/Saving-Your-Data + * @link http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#model-read */ public function saveField($name, $value, $validate = false) { $id = $this->id; @@ -1496,7 +1495,7 @@ class Model extends Object { * If an array, allows control of validate, callbacks, and fieldList * @param array $fieldList List of fields to allow to be written * @return mixed On success Model::$data if its not empty or true, false on failure - * @link http://book.cakephp.org/view/1031/Saving-Your-Data + * @link http://book.cakephp.org/2.0/en/models/saving-your-data.html */ public function save($data = null, $validate = true, $fieldList = array()) { $defaults = array('validate' => true, 'fieldList' => array(), 'callbacks' => true); @@ -1871,8 +1870,8 @@ class Model extends Object { * @return mixed If atomic: True on success, or false on failure. * Otherwise: array similar to the $data array passed, but values are set to true/false * depending on whether each record saved successfully. - * @link http://book.cakephp.org/view/1032/Saving-Related-Model-Data-hasOne-hasMany-belongsTo - * @link http://book.cakephp.org/view/1031/Saving-Your-Data + * @link http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-saveassociated-array-data-null-array-options-array + * @link http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-saveall-array-data-null-array-options-array */ public function saveAll($data = null, $options = array()) { $options = array_merge(array('validate' => 'first'), $options); @@ -1908,6 +1907,7 @@ class Model extends Object { * @return mixed If atomic: True on success, or false on failure. * Otherwise: array similar to the $data array passed, but values are set to true/false * depending on whether each record saved successfully. + * @link http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-savemany-array-data-null-array-options-array */ public function saveMany($data = null, $options = array()) { if (empty($data)) { @@ -2012,6 +2012,7 @@ class Model extends Object { * @return mixed If atomic: True on success, or false on failure. * Otherwise: array similar to the $data array passed, but values are set to true/false * depending on whether each record saved successfully. + * @link http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-saveassociated-array-data-null-array-options-array */ public function saveAssociated($data = null, $options = array()) { if (empty($data)) { @@ -2165,7 +2166,7 @@ class Model extends Object { * Fields are treated as SQL snippets, to insert literal values manually escape your data. * @param mixed $conditions Conditions to match, true for all records * @return boolean True on success, false on failure - * @link http://book.cakephp.org/view/1031/Saving-Your-Data + * @link http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-updateall-array-fields-array-conditions */ public function updateAll($fields, $conditions = true) { return $this->getDataSource()->update($this, $fields, null, $conditions); @@ -2177,7 +2178,7 @@ class Model extends Object { * @param mixed $id ID of record to delete * @param boolean $cascade Set to true to delete records that depend on this record * @return boolean True on success - * @link http://book.cakephp.org/view/1036/delete + * @link http://book.cakephp.org/2.0/en/models/deleting-data.html */ public function delete($id = null, $cascade = true) { if (!empty($id)) { @@ -2303,7 +2304,7 @@ class Model extends Object { * @param boolean $cascade Set to true to delete records that depend on this record * @param boolean $callbacks Run callbacks * @return boolean True on success, false on failure - * @link http://book.cakephp.org/view/1038/deleteAll + * @link http://book.cakephp.org/2.0/en/models/deleting-data.html#deleteall */ public function deleteAll($conditions, $cascade = true, $callbacks = false) { if (empty($conditions)) { @@ -2443,7 +2444,7 @@ class Model extends Object { * @param string $type Type of find operation (all / first / count / neighbors / list / threaded) * @param array $query Option fields (conditions / fields / joins / limit / offset / order / page / group / callbacks) * @return array Array of records - * @link http://book.cakephp.org/view/1018/find + * @link http://book.cakephp.org/2.0/en/models/deleting-data.html#deleteall */ public function find($type = 'first', $query = array()) { $this->findQueryType = $type; @@ -2841,7 +2842,7 @@ class Model extends Object { * * @param string $sql,... SQL statement * @return array Resultset - * @link http://book.cakephp.org/view/1027/query + * @link http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#model-query */ public function query($sql) { $params = func_get_args(); @@ -2857,7 +2858,6 @@ class Model extends Object { * * @param string $options An optional array of custom options to be made available in the beforeValidate callback * @return boolean True if there are no errors - * @link http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller */ public function validates($options = array()) { $errors = $this->invalidFields($options); @@ -2876,7 +2876,6 @@ class Model extends Object { * @param string $options An optional array of custom options to be made available in the beforeValidate callback * @return array Array of invalid fields * @see Model::validates() - * @link http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller */ public function invalidFields($options = array()) { if (