mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #2523 from bar/2.5-dbosource
Update documentation and typehint.
This commit is contained in:
commit
4e55aa43f0
1 changed files with 7 additions and 5 deletions
|
@ -1437,15 +1437,17 @@ class DboSource extends DataSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merge the results of hasMany relations.
|
* Merge the results of 'hasMany' associations.
|
||||||
|
*
|
||||||
|
* Note: this function also deals with the formatting of the data.
|
||||||
*
|
*
|
||||||
* @param array $resultSet Data to merge into.
|
* @param array $resultSet Data to merge into.
|
||||||
* @param array $merge Data to merge.
|
* @param array $assocResultSet Data to merge.
|
||||||
* @param string $association Name of Model being merged.
|
* @param string $association Name of Model being merged.
|
||||||
* @param Model $Model Model being merged onto.
|
* @param Model $Model Model being merged onto.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function _mergeHasMany(&$resultSet, $merge, $association, $Model) {
|
protected function _mergeHasMany(&$resultSet, $assocResultSet, $association, Model $Model) {
|
||||||
$modelAlias = $Model->alias;
|
$modelAlias = $Model->alias;
|
||||||
$primaryKey = $Model->primaryKey;
|
$primaryKey = $Model->primaryKey;
|
||||||
$foreignKey = $Model->hasMany[$association]['foreignKey'];
|
$foreignKey = $Model->hasMany[$association]['foreignKey'];
|
||||||
|
@ -1458,7 +1460,7 @@ class DboSource extends DataSource {
|
||||||
$resultPrimaryKey = $result[$modelAlias][$primaryKey];
|
$resultPrimaryKey = $result[$modelAlias][$primaryKey];
|
||||||
|
|
||||||
$merged = array();
|
$merged = array();
|
||||||
foreach ($merge as $data) {
|
foreach ($assocResultSet as $data) {
|
||||||
if ($resultPrimaryKey !== $data[$association][$foreignKey]) {
|
if ($resultPrimaryKey !== $data[$association][$foreignKey]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1637,7 +1639,7 @@ class DboSource extends DataSource {
|
||||||
* @param boolean $external Whether or not the association query is on an external datasource.
|
* @param boolean $external Whether or not the association query is on an external datasource.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* String representing a query.
|
* String representing a query.
|
||||||
* True. when $external is false and association $type is 'hasOne' or 'belongsTo'.
|
* True, when $external is false and association $type is 'hasOne' or 'belongsTo'.
|
||||||
*/
|
*/
|
||||||
public function generateAssociationQuery(Model $Model, Model $LinkModel, $type, $association, $assocData, &$queryData, $external) {
|
public function generateAssociationQuery(Model $Model, Model $LinkModel, $type, $association, $assocData, &$queryData, $external) {
|
||||||
$assocData = $this->_scrubQueryData($assocData);
|
$assocData = $this->_scrubQueryData($assocData);
|
||||||
|
|
Loading…
Reference in a new issue