From 6fd89c96d512d6ca1b122c33ea0251fc8a82d22a Mon Sep 17 00:00:00 2001 From: phpnut Date: Thu, 21 Jul 2005 04:40:30 +0000 Subject: [PATCH] merging from source:whiteboard/sandbox/phpnut/pre_0.9.2 at [409] git-svn-id: https://svn.cakephp.org/repo/trunk/cake@410 3807eeeb-6ff5-0310-8944-8be069107fe0 --- libs/model.php | 34 +++++++++++-------------- libs/model_collection.php | 53 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 20 deletions(-) create mode 100644 libs/model_collection.php diff --git a/libs/model.php b/libs/model.php index 50df60f37..6a8e83212 100644 --- a/libs/model.php +++ b/libs/model.php @@ -201,20 +201,18 @@ class Model extends Object { return $this->_belongsToLink(); } - if (!empty($this->hasOne)) { $this->_hasOneLink(); - } - if (!empty($this->hasMany)) - { - return $this->_hasManyLinks(); - } - - if (!empty($this->hasAndBelongsToMany)) - { - return $this->_hasAndBelongsToManyLinks(); - } + } + if (!empty($this->hasMany)) + { + return $this->_hasManyLinks(); + } + if (!empty($this->hasAndBelongsToMany)) + { + return $this->_hasAndBelongsToManyLinks(); + } } /** @@ -528,19 +526,19 @@ class Model extends Object switch($type) { case 'Belongs': - $joinedHas = 'joinedBelongsTo'; + $joined = 'joinedBelongsTo'; break; case 'One': - $joinedHas = 'joinedHasOne'; + $joined = 'joinedHasOne'; break; case 'Many': - $joinedHas = 'joinedHasMany'; + $joined = 'joinedHasMany'; break; case 'ManyTo': - $joinedHas = 'joinedHasAndBelongs'; + $joined = 'joinedHasAndBelongs'; break; default: @@ -553,7 +551,7 @@ class Model extends Object { $this->$className = new $className(); } - $this->{$joinedHas}[] = $this->$className; + $this->{$joined}[] = $this->$className; $this->relink($type); } @@ -678,22 +676,18 @@ class Model extends Object switch ($type) { case 'Belongs': - $this->_belongsToOther[] = array($tableName, $field_name, $value); break; case 'One': - //$field_name = Inflector::singularize($tableName).'_id'; $this->_oneToOne[] = array($tableName, $field_name, $value); break; case 'Many': - $this->_oneToMany[] = array($tableName, $field_name, $value); break; case 'ManyTo': - $this->_manyToMany = array(); break; } diff --git a/libs/model_collection.php b/libs/model_collection.php new file mode 100644 index 000000000..6b22be298 --- /dev/null +++ b/libs/model_collection.php @@ -0,0 +1,53 @@ + + // +// + Copyright: (c) 2005, CakePHP Authors/Developers + // +// + Author(s): Michal Tatarynowicz aka Pies + // +// + Larry E. Masters aka PhpNut + // +// + Kamil Dzielinski aka Brego + // +// +------------------------------------------------------------------+ // +// + Licensed under The MIT License + // +// + Redistributions of files must retain the above copyright notice. + // +// + See: http://www.opensource.org/licenses/mit-license.php + // +////////////////////////////////////////////////////////////////////////// + +/** + * Model Collections. + * + * @filesource + * @author CakePHP Authors/Developers + * @copyright Copyright (c) 2005, CakePHP Authors/Developers + * @link https://trac.cakephp.org/wiki/Authors Authors/Developers + * @package cake + * @subpackage cake.libs + * @since CakePHP v 0.9.2 + * @version $Revision$ + * @modifiedby $LastChangedBy$ + * @lastmodified $Date$ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + * + */ + +/** + * Model Collections. + * + * @package cake + * @subpackage cake.libs + * @since CakePHP v 0.9.2 + * + */ + class ModelCollection + { + +/** + * Enter description here... + * + * @return ModelCollection + */ + function ModelCollection() + { + } + } +?> \ No newline at end of file