Skip to content

Commit

Permalink
rename parameters to match parents (#8284)
Browse files Browse the repository at this point in the history
  • Loading branch information
orklah committed Sep 26, 2020
1 parent f4524a8 commit 79cdcde
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 40 deletions.
20 changes: 10 additions & 10 deletions lib/Doctrine/ORM/Cache/Persister/Entity/AbstractEntityPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,18 +544,18 @@ public function loadCriteria(Criteria $criteria)
/**
* {@inheritdoc}
*/
public function loadManyToManyCollection(array $assoc, $sourceEntity, PersistentCollection $coll)
public function loadManyToManyCollection(array $assoc, $sourceEntity, PersistentCollection $collection)
{
$persister = $this->uow->getCollectionPersister($assoc);
$hasCache = ($persister instanceof CachedPersister);

if ( ! $hasCache) {
return $this->persister->loadManyToManyCollection($assoc, $sourceEntity, $coll);
return $this->persister->loadManyToManyCollection($assoc, $sourceEntity, $collection);
}

$ownerId = $this->uow->getEntityIdentifier($coll->getOwner());
$ownerId = $this->uow->getEntityIdentifier($collection->getOwner());
$key = $this->buildCollectionCacheKey($assoc, $ownerId);
$list = $persister->loadCollectionCache($coll, $key);
$list = $persister->loadCollectionCache($collection, $key);

if ($list !== null) {
if ($this->cacheLogger) {
Expand All @@ -565,7 +565,7 @@ public function loadManyToManyCollection(array $assoc, $sourceEntity, Persistent
return $list;
}

$list = $this->persister->loadManyToManyCollection($assoc, $sourceEntity, $coll);
$list = $this->persister->loadManyToManyCollection($assoc, $sourceEntity, $collection);

$persister->storeCollectionCache($key, $list);

Expand All @@ -579,18 +579,18 @@ public function loadManyToManyCollection(array $assoc, $sourceEntity, Persistent
/**
* {@inheritdoc}
*/
public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentCollection $coll)
public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentCollection $collection)
{
$persister = $this->uow->getCollectionPersister($assoc);
$hasCache = ($persister instanceof CachedPersister);

if ( ! $hasCache) {
return $this->persister->loadOneToManyCollection($assoc, $sourceEntity, $coll);
return $this->persister->loadOneToManyCollection($assoc, $sourceEntity, $collection);
}

$ownerId = $this->uow->getEntityIdentifier($coll->getOwner());
$ownerId = $this->uow->getEntityIdentifier($collection->getOwner());
$key = $this->buildCollectionCacheKey($assoc, $ownerId);
$list = $persister->loadCollectionCache($coll, $key);
$list = $persister->loadCollectionCache($collection, $key);

if ($list !== null) {
if ($this->cacheLogger) {
Expand All @@ -600,7 +600,7 @@ public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentC
return $list;
}

$list = $this->persister->loadOneToManyCollection($assoc, $sourceEntity, $coll);
$list = $this->persister->loadOneToManyCollection($assoc, $sourceEntity, $collection);

$persister->storeCollectionCache($key, $list);

Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/ORM/Decorator/EntityManagerDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ public function lock($entity, $lockMode, $lockVersion = null)
/**
* {@inheritdoc}
*/
public function find($entityName, $id, $lockMode = null, $lockVersion = null)
public function find($className, $id, $lockMode = null, $lockVersion = null)
{
return $this->wrapped->find($entityName, $id, $lockMode, $lockVersion);
return $this->wrapped->find($className, $id, $lockMode, $lockVersion);
}

/**
Expand Down
7 changes: 4 additions & 3 deletions lib/Doctrine/ORM/EntityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use Doctrine\Persistence\Mapping\MappingException;
use Doctrine\Persistence\ObjectRepository;
use Throwable;
use function ltrim;
use const E_USER_DEPRECATED;
use function trigger_error;

Expand Down Expand Up @@ -373,7 +374,7 @@ public function flush($entity = null)
/**
* Finds an Entity by its identifier.
*
* @param string $entityName The class name of the entity to find.
* @param string $className The class name of the entity to find.
* @param mixed $id The identity of the entity to find.
* @param integer|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants
* or NULL if no specific lock mode should be used
Expand All @@ -388,9 +389,9 @@ public function flush($entity = null)
* @throws TransactionRequiredException
* @throws ORMException
*/
public function find($entityName, $id, $lockMode = null, $lockVersion = null)
public function find($className, $id, $lockMode = null, $lockVersion = null)
{
$class = $this->metadataFactory->getMetadataFor(ltrim($entityName, '\\'));
$class = $this->metadataFactory->getMetadataFor(ltrim($className, '\\'));

if ($lockMode !== null) {
$this->checkLockRequirements($lockMode, $class);
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ protected function cleanup()
*
* Template method.
*
* @param array $data The row data.
* @param array $result The result to fill.
* @param mixed[] $row The row data.
* @param mixed[] $result The result to fill.
*
* @return void
*
* @throws HydrationException
*/
protected function hydrateRowData(array $data, array &$result)
protected function hydrateRowData(array $row, array &$result)
{
throw new HydrationException("hydrateRowData() not implemented by this hydrator.");
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/ORM/Internal/Hydration/ScalarHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ protected function hydrateAllData()
/**
* {@inheritdoc}
*/
protected function hydrateRowData(array $data, array &$result)
protected function hydrateRowData(array $row, array &$result)
{
$result[] = $this->gatherScalarRowData($data);
$result[] = $this->gatherScalarRowData($row);
}
}
19 changes: 10 additions & 9 deletions lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use PDO;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Query;
use function array_keys;
use function in_array;

class SimpleObjectHydrator extends AbstractHydrator
Expand Down Expand Up @@ -77,7 +78,7 @@ protected function hydrateAllData()
/**
* {@inheritdoc}
*/
protected function hydrateRowData(array $sqlResult, array &$result)
protected function hydrateRowData(array $row, array &$result)
{
$entityName = $this->class->name;
$data = [];
Expand All @@ -92,27 +93,27 @@ protected function hydrateRowData(array $sqlResult, array &$result)
$discrColumnName = $metaMappingDiscrColumnName;
}

if ( ! isset($sqlResult[$discrColumnName])) {
if (! isset($row[$discrColumnName])) {
throw HydrationException::missingDiscriminatorColumn($entityName, $discrColumnName, key($this->_rsm->aliasMap));
}

if ($sqlResult[$discrColumnName] === '') {
if ($row[$discrColumnName] === '') {
throw HydrationException::emptyDiscriminatorValue(key($this->_rsm->aliasMap));
}

$discrMap = $this->class->discriminatorMap;

if ( ! isset($discrMap[$sqlResult[$discrColumnName]])) {
throw HydrationException::invalidDiscriminatorValue($sqlResult[$discrColumnName], array_keys($discrMap));
if (! isset($discrMap[$row[$discrColumnName]])) {
throw HydrationException::invalidDiscriminatorValue($row[$discrColumnName], array_keys($discrMap));
}

$entityName = $discrMap[$sqlResult[$discrColumnName]];
$discrColumnValue = $sqlResult[$discrColumnName];
$entityName = $discrMap[$row[$discrColumnName]];
$discrColumnValue = $row[$discrColumnName];

unset($sqlResult[$discrColumnName]);
unset($row[$discrColumnName]);
}

foreach ($sqlResult as $column => $value) {
foreach ($row as $column => $value) {
// An ObjectHydrator should be used instead of SimpleObjectHydrator
if (isset($this->_rsm->relationMap[$column])) {
throw new \Exception(sprintf('Unable to retrieve association information for column "%s"', $column));
Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -987,11 +987,11 @@ private function loadCollectionFromStatement($assoc, $stmt, $coll)
/**
* {@inheritdoc}
*/
public function loadManyToManyCollection(array $assoc, $sourceEntity, PersistentCollection $coll)
public function loadManyToManyCollection(array $assoc, $sourceEntity, PersistentCollection $collection)
{
$stmt = $this->getManyToManyStatement($assoc, $sourceEntity);

return $this->loadCollectionFromStatement($assoc, $stmt, $coll);
return $this->loadCollectionFromStatement($assoc, $stmt, $collection);
}

/**
Expand Down Expand Up @@ -1795,11 +1795,11 @@ public function getOneToManyCollection(array $assoc, $sourceEntity, $offset = nu
/**
* {@inheritdoc}
*/
public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentCollection $coll)
public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentCollection $collection)
{
$stmt = $this->getOneToManyStatement($assoc, $sourceEntity);

return $this->loadCollectionFromStatement($assoc, $stmt, $coll);
return $this->loadCollectionFromStatement($assoc, $stmt, $collection);
}

/**
Expand Down
15 changes: 8 additions & 7 deletions lib/Doctrine/ORM/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
use Throwable;
use UnexpectedValueException;
use function get_class;
use function spl_object_hash;

/**
* The UnitOfWork is responsible for tracking changes to objects during an
Expand Down Expand Up @@ -472,7 +473,7 @@ private function postCommitCleanup($entity) : void
: $entity;

foreach ($entities as $object) {
$oid = \spl_object_hash($object);
$oid = spl_object_hash($object);

$this->clearEntityChangeSet($oid);

Expand Down Expand Up @@ -897,7 +898,7 @@ private function computeAssociationChanges($assoc, $value)
* through the object-graph where cascade-persistence
* is enabled for this object.
*/
$this->nonCascadedNewDetectedEntities[\spl_object_hash($entry)] = [$assoc, $entry];
$this->nonCascadedNewDetectedEntities[spl_object_hash($entry)] = [$assoc, $entry];

break;
}
Expand Down Expand Up @@ -3214,17 +3215,17 @@ public function clearEntityChangeSet($oid)
/**
* Notifies this UnitOfWork of a property change in an entity.
*
* @param object $entity The entity that owns the property.
* @param object $sender The entity that owns the property.
* @param string $propertyName The name of the property that changed.
* @param mixed $oldValue The old value of the property.
* @param mixed $newValue The new value of the property.
*
* @return void
*/
public function propertyChanged($entity, $propertyName, $oldValue, $newValue)
public function propertyChanged($sender, $propertyName, $oldValue, $newValue)
{
$oid = spl_object_hash($entity);
$class = $this->em->getClassMetadata(get_class($entity));
$oid = spl_object_hash($sender);
$class = $this->em->getClassMetadata(get_class($sender));

$isAssocField = isset($class->associationMappings[$propertyName]);

Expand All @@ -3236,7 +3237,7 @@ public function propertyChanged($entity, $propertyName, $oldValue, $newValue)
$this->entityChangeSets[$oid][$propertyName] = [$oldValue, $newValue];

if ( ! isset($this->scheduledForSynchronization[$class->rootEntityName][$oid])) {
$this->scheduleForDirtyCheck($entity);
$this->scheduleForDirtyCheck($sender);
}
}

Expand Down

0 comments on commit 79cdcde

Please sign in to comment.