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
This commit is contained in:
phpnut 2005-07-21 04:40:30 +00:00
parent 009383941a
commit 6fd89c96d5
2 changed files with 67 additions and 20 deletions

View file

@ -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;
}

53
libs/model_collection.php Normal file
View file

@ -0,0 +1,53 @@
<?php
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake PHP : Rapid Development Framework <http://www.cakephp.org/> + //
// + Copyright: (c) 2005, CakePHP Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + 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()
{
}
}
?>