mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Changed access to private __associations on Model to associations() calls.
This commit is contained in:
parent
97388d2e61
commit
3c2e7a091d
5 changed files with 18 additions and 8 deletions
|
@ -527,7 +527,7 @@ class DataSource extends Object {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '{$__cakeForeignKey__$}':
|
case '{$__cakeForeignKey__$}':
|
||||||
foreach ($model->__associations as $id => $name) {
|
foreach ($model->associations() as $id => $name) {
|
||||||
foreach ($model->$name as $assocName => $assoc) {
|
foreach ($model->$name as $assocName => $assoc) {
|
||||||
if ($assocName === $association) {
|
if ($assocName === $association) {
|
||||||
if (isset($assoc['foreignKey'])) {
|
if (isset($assoc['foreignKey'])) {
|
||||||
|
|
|
@ -1026,7 +1026,7 @@ class DboOracle extends DboSource {
|
||||||
if (!empty($fetch) && is_array($fetch)) {
|
if (!empty($fetch) && is_array($fetch)) {
|
||||||
if ($recursive > 0) {
|
if ($recursive > 0) {
|
||||||
|
|
||||||
foreach ($linkModel->__associations as $type1) {
|
foreach ($linkModel->associations() as $type1) {
|
||||||
foreach ($linkModel->{$type1} as $assoc1 => $assocData1) {
|
foreach ($linkModel->{$type1} as $assoc1 => $assocData1) {
|
||||||
$deepModel =& $linkModel->{$assoc1};
|
$deepModel =& $linkModel->{$assoc1};
|
||||||
$tmpStack = $stack;
|
$tmpStack = $stack;
|
||||||
|
@ -1088,7 +1088,7 @@ class DboOracle extends DboSource {
|
||||||
if (!empty($fetch) && is_array($fetch)) {
|
if (!empty($fetch) && is_array($fetch)) {
|
||||||
if ($recursive > 0) {
|
if ($recursive > 0) {
|
||||||
|
|
||||||
foreach ($linkModel->__associations as $type1) {
|
foreach ($linkModel->associations() as $type1) {
|
||||||
foreach ($linkModel->{$type1} as $assoc1 => $assocData1) {
|
foreach ($linkModel->{$type1} as $assoc1 => $assocData1) {
|
||||||
|
|
||||||
$deepModel =& $linkModel->{$assoc1};
|
$deepModel =& $linkModel->{$assoc1};
|
||||||
|
|
|
@ -779,7 +779,7 @@ class DboSource extends DataSource {
|
||||||
$queryData['fields'] = $this->fields($model);
|
$queryData['fields'] = $this->fields($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_associations = $model->__associations;
|
$_associations = $model->associations();
|
||||||
|
|
||||||
if ($model->recursive == -1) {
|
if ($model->recursive == -1) {
|
||||||
$_associations = array();
|
$_associations = array();
|
||||||
|
@ -922,7 +922,7 @@ class DboSource extends DataSource {
|
||||||
|
|
||||||
if (!empty($fetch) && is_array($fetch)) {
|
if (!empty($fetch) && is_array($fetch)) {
|
||||||
if ($recursive > 0) {
|
if ($recursive > 0) {
|
||||||
foreach ($linkModel->__associations as $type1) {
|
foreach ($linkModel->associations() as $type1) {
|
||||||
foreach ($linkModel->{$type1} as $assoc1 => $assocData1) {
|
foreach ($linkModel->{$type1} as $assoc1 => $assocData1) {
|
||||||
$deepModel =& $linkModel->{$assoc1};
|
$deepModel =& $linkModel->{$assoc1};
|
||||||
$tmpStack = $stack;
|
$tmpStack = $stack;
|
||||||
|
@ -991,7 +991,7 @@ class DboSource extends DataSource {
|
||||||
|
|
||||||
if (!empty($fetch) && is_array($fetch)) {
|
if (!empty($fetch) && is_array($fetch)) {
|
||||||
if ($recursive > 0) {
|
if ($recursive > 0) {
|
||||||
foreach ($linkModel->__associations as $type1) {
|
foreach ($linkModel->associations() as $type1) {
|
||||||
foreach ($linkModel->{$type1} as $assoc1 => $assocData1) {
|
foreach ($linkModel->{$type1} as $assoc1 => $assocData1) {
|
||||||
$deepModel =& $linkModel->{$assoc1};
|
$deepModel =& $linkModel->{$assoc1};
|
||||||
|
|
||||||
|
|
|
@ -2814,6 +2814,16 @@ class Model extends Overloadable {
|
||||||
return $db;
|
return $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get associations
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function associations() {
|
||||||
|
return $this->__associations;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all the models with which this model is associated.
|
* Gets all the models with which this model is associated.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1400,7 +1400,7 @@ class DboSourceTest extends CakeTestCase {
|
||||||
|
|
||||||
$queryData = array();
|
$queryData = array();
|
||||||
|
|
||||||
foreach ($this->Model->Category2->__associations as $type) {
|
foreach ($this->Model->Category2->associations() as $type) {
|
||||||
foreach ($this->Model->Category2->{$type} as $assoc => $assocData) {
|
foreach ($this->Model->Category2->{$type} as $assoc => $assocData) {
|
||||||
$linkModel =& $this->Model->Category2->{$assoc};
|
$linkModel =& $this->Model->Category2->{$assoc};
|
||||||
$external = isset($assocData['external']);
|
$external = isset($assocData['external']);
|
||||||
|
@ -2185,7 +2185,7 @@ class DboSourceTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function _buildRelatedModels(&$model) {
|
function _buildRelatedModels(&$model) {
|
||||||
foreach ($model->__associations as $type) {
|
foreach ($model->associations() as $type) {
|
||||||
foreach ($model->{$type} as $assoc => $assocData) {
|
foreach ($model->{$type} as $assoc => $assocData) {
|
||||||
if (is_string($assocData)) {
|
if (is_string($assocData)) {
|
||||||
$className = $assocData;
|
$className = $assocData;
|
||||||
|
|
Loading…
Reference in a new issue