mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Making Model::resetAssociations public and changing tests that use it
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6909 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
bc6a8e03b5
commit
05047a90b0
2 changed files with 6 additions and 6 deletions
|
@ -398,7 +398,7 @@ class Model extends Overloadable {
|
|||
$return = $db->query($method, $params, $this);
|
||||
|
||||
if (!PHP5) {
|
||||
$this->__resetAssociations();
|
||||
$this->resetAssociations();
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
@ -1763,7 +1763,7 @@ class Model extends Overloadable {
|
|||
}
|
||||
|
||||
$results = $db->read($this, $query);
|
||||
$this->__resetAssociations();
|
||||
$this->resetAssociations();
|
||||
$this->findQueryType = null;
|
||||
|
||||
if ($type === 'all') {
|
||||
|
@ -1897,9 +1897,9 @@ class Model extends Overloadable {
|
|||
* to the original as set in the model.
|
||||
*
|
||||
* @return boolean Success
|
||||
* @access private
|
||||
* @access public
|
||||
*/
|
||||
function __resetAssociations() {
|
||||
function resetAssociations() {
|
||||
if (!empty($this->__backAssociation)) {
|
||||
foreach ($this->__associations as $type) {
|
||||
if (isset($this->__backAssociation[$type])) {
|
||||
|
@ -1912,7 +1912,7 @@ class Model extends Overloadable {
|
|||
foreach ($this->__associations as $type) {
|
||||
foreach ($this->{$type} as $key => $name) {
|
||||
if (!empty($this->{$key}->__backAssociation)) {
|
||||
$this->{$key}->__resetAssociations();
|
||||
$this->{$key}->resetAssociations();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -969,7 +969,7 @@ class ModelTest extends CakeTestCase {
|
|||
array('id' => '2', 'article_id' => '1', 'user_id' => '4', 'comment' => 'Second Comment for First Article', 'published' => 'Y', 'created' => '2007-03-18 10:47:23', 'updated' => '2007-03-18 10:49:31'))));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$TestModel->__resetAssociations();
|
||||
$TestModel->resetAssociations();
|
||||
$result = $TestModel->hasMany;
|
||||
$this->assertEqual($result, array());
|
||||
|
||||
|
|
Loading…
Reference in a new issue