Skip to content

Commit

Permalink
Merge pull request doctrine#41 from nitra/master
Browse files Browse the repository at this point in the history
 PHP 7.2 - deprecated "each" calls
  • Loading branch information
j0k3r committed Mar 20, 2018
2 parents 19ed440 + 23c6c40 commit ca85260
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -7,6 +7,7 @@ php:
- 5.6
- 7.0
- 7.1
- 7.2
- hhvm
- nightly

Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/Connection/UnitOfWork.php
Expand Up @@ -237,7 +237,7 @@ private function _executeDeletions(array $deletions)
$params = array();
$columnNames = array();
foreach ($identifierMaps as $idMap) {
while (list($fieldName, $value) = each($idMap)) {
foreach($idMap as $fieldName => $value) {
$params[] = $value;
$columnNames[] = $table->getColumnName($fieldName);
}
Expand Down Expand Up @@ -957,4 +957,4 @@ protected function _assignIdentifier(Doctrine_Record $record)
$record->assignIdentifier(true);
}
}
}
}
17 changes: 9 additions & 8 deletions lib/Doctrine/Hydrator/Graph.php
Expand Up @@ -256,7 +256,7 @@ public function hydrateResultSet($stmt)
} else if ( ! isset($prev[$parent][$relationAlias])) {
$element = $this->getElement($data, $componentName);

// [FIX] Tickets #1205 and #1237
// [FIX] Tickets #1205 and #1237
$event->set('data', $element);
$listeners[$componentName]->postHydrate($event);
$instances[$componentName]->postHydrate($event);
Expand Down Expand Up @@ -409,20 +409,21 @@ protected function _getClassnameToReturn(array &$data, $component)
$needMatches = count($inheritanceMap);
foreach ($inheritanceMap as $key => $value) {
$key = $this->_tables[$component]->getFieldName($key);
if ( isset($data[$key]) && $data[$key] == $value) {
if (isset($data[$key]) && $data[$key] == $value) {
--$needMatches;
}
}
if ($needMatches == 0) {
$matchedComponents[] = $table->getComponentName();
}
} else {
list($key, $value) = each($inheritanceMap);
$key = $this->_tables[$component]->getFieldName($key);
if ( ! isset($data[$key]) || $data[$key] != $value) {
continue;
} else {
$matchedComponents[] = $table->getComponentName();
foreach ($inheritanceMap as $key => $value) {
$key = $this->_tables[$component]->getFieldName($key);
if (!isset($data[$key]) || $data[$key] != $value) {
continue;
} else {
$matchedComponents[] = $table->getComponentName();
}
}
}
}
Expand Down

0 comments on commit ca85260

Please sign in to comment.