Skip to content

Commit

Permalink
Simplifying getColumnNames logic (can be an array_map call)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Dec 11, 2015
1 parent b2a6f8a commit 044b202
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -1873,17 +1873,11 @@ public function hasField($fieldName)
*/
public function getColumnNames(array $fieldNames = null)
{
if ($fieldNames === null) {
if (null === $fieldNames) {
return array_keys($this->fieldNames);
}

$columnNames = array();

foreach ($fieldNames as $fieldName) {
$columnNames[] = $this->getColumnName($fieldName);
}

return $columnNames;
return array_values(array_map([$this, 'getColumnName'], $fieldNames));
}

/**
Expand Down

0 comments on commit 044b202

Please sign in to comment.