1
0
mirror of synced 2024-12-14 15:16:04 +03:00

Fix some CS

This commit is contained in:
Fabio B. Silva 2012-08-12 15:17:47 -03:00
parent 827153624c
commit a295525501
2 changed files with 23 additions and 19 deletions

View File

@ -87,6 +87,7 @@ abstract class AbstractCollectionPersister
} }
$sql = $this->getDeleteSQL($coll); $sql = $this->getDeleteSQL($coll);
$this->conn->executeUpdate($sql, $this->getDeleteSQLParameters($coll)); $this->conn->executeUpdate($sql, $this->getDeleteSQLParameters($coll));
} }
@ -157,6 +158,7 @@ abstract class AbstractCollectionPersister
* Count the size of this persistent collection * Count the size of this persistent collection
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
*
* @return integer * @return integer
*/ */
public function count(PersistentCollection $coll) public function count(PersistentCollection $coll)
@ -170,6 +172,7 @@ abstract class AbstractCollectionPersister
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param integer $offset * @param integer $offset
* @param integer $length * @param integer $length
*
* @return array * @return array
*/ */
public function slice(PersistentCollection $coll, $offset, $length = null) public function slice(PersistentCollection $coll, $offset, $length = null)
@ -182,6 +185,7 @@ abstract class AbstractCollectionPersister
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param mixed \Doctrine\ORM\PersistentCollection * @param mixed \Doctrine\ORM\PersistentCollection
*
* @return boolean * @return boolean
*/ */
public function contains(PersistentCollection $coll, $element) public function contains(PersistentCollection $coll, $element)
@ -194,6 +198,7 @@ abstract class AbstractCollectionPersister
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param mixed $key * @param mixed $key
*
* @return boolean * @return boolean
*/ */
public function containsKey(PersistentCollection $coll, $key) public function containsKey(PersistentCollection $coll, $key)
@ -206,6 +211,7 @@ abstract class AbstractCollectionPersister
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element * @param object $element
*
* @return mixed * @return mixed
*/ */
public function removeElement(PersistentCollection $coll, $element) public function removeElement(PersistentCollection $coll, $element)
@ -217,6 +223,7 @@ abstract class AbstractCollectionPersister
* Remove an element by key * Remove an element by key
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
*
* @param mixed $key * @param mixed $key
*/ */
public function removeKey(PersistentCollection $coll, $key) public function removeKey(PersistentCollection $coll, $key)

View File

@ -302,6 +302,7 @@ class BasicEntityPersister
protected function assignDefaultVersionValue($entity, $id) protected function assignDefaultVersionValue($entity, $id)
{ {
$value = $this->fetchVersionValue($this->class, $id); $value = $this->fetchVersionValue($this->class, $id);
$this->class->setFieldValue($entity, $this->class->versionField, $value); $this->class->setFieldValue($entity, $this->class->versionField, $value);
} }
@ -324,11 +325,9 @@ class BasicEntityPersister
. ' FROM ' . $tableName . ' FROM ' . $tableName
. ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?'; . ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?';
$value = $this->conn->fetchColumn($sql, array_values((array)$id)); $value = $this->conn->fetchColumn($sql, array_values((array) $id));
$value = Type::getType($versionedClass->fieldMappings[$versionField]['type'])
->convertToPHPValue($value, $this->platform);
return $value; return Type::getType($versionedClass->fieldMappings[$versionField]['type'])->convertToPHPValue($value, $this->platform);
} }
/** /**
@ -454,6 +453,7 @@ class BasicEntityPersister
case Type::INTEGER: case Type::INTEGER:
$set[] = $versionColumn . ' = ' . $versionColumn . ' + 1'; $set[] = $versionColumn . ' = ' . $versionColumn . ' + 1';
break; break;
case Type::DATETIME: case Type::DATETIME:
$set[] = $versionColumn . ' = CURRENT_TIMESTAMP'; $set[] = $versionColumn . ' = CURRENT_TIMESTAMP';
break; break;
@ -610,9 +610,8 @@ class BasicEntityPersister
// The associated entity $newVal is not yet persisted, so we must // The associated entity $newVal is not yet persisted, so we must
// set $newVal = null, in order to insert a null value and schedule an // set $newVal = null, in order to insert a null value and schedule an
// extra update on the UnitOfWork. // extra update on the UnitOfWork.
$uow->scheduleExtraUpdate($entity, array( $uow->scheduleExtraUpdate($entity, array($field => array(null, $newVal)));
$field => array(null, $newVal)
));
$newVal = null; $newVal = null;
} }
} }
@ -918,8 +917,7 @@ class BasicEntityPersister
$rsm->addIndexBy('r', $assoc['indexBy']); $rsm->addIndexBy('r', $assoc['indexBy']);
} }
return $this->em->newHydrator(Query::HYDRATE_OBJECT) return $this->em->newHydrator(Query::HYDRATE_OBJECT)->hydrateAll($stmt, $rsm, $hints);
->hydrateAll($stmt, $rsm, $hints);
} }
/** /**
@ -944,8 +942,7 @@ class BasicEntityPersister
$rsm->addIndexBy('r', $assoc['indexBy']); $rsm->addIndexBy('r', $assoc['indexBy']);
} }
return $this->em->newHydrator(Query::HYDRATE_OBJECT) return $this->em->newHydrator(Query::HYDRATE_OBJECT)->hydrateAll($stmt, $rsm, $hints);
->hydrateAll($stmt, $rsm, $hints);
} }
/** /**
@ -1059,11 +1056,10 @@ class BasicEntityPersister
switch ($lockMode) { switch ($lockMode) {
case LockMode::PESSIMISTIC_READ: case LockMode::PESSIMISTIC_READ:
$lockSql = ' ' . $this->platform->getReadLockSql(); $lockSql = ' ' . $this->platform->getReadLockSql();
break; break;
case LockMode::PESSIMISTIC_WRITE: case LockMode::PESSIMISTIC_WRITE:
$lockSql = ' ' . $this->platform->getWriteLockSql(); $lockSql = ' ' . $this->platform->getWriteLockSql();
break; break;
} }
@ -1082,13 +1078,14 @@ class BasicEntityPersister
$from = ' FROM ' . $tableName . ' '. $tableAlias; $from = ' FROM ' . $tableName . ' '. $tableAlias;
$join = $this->selectJoinSql . $joinSql; $join = $this->selectJoinSql . $joinSql;
$where = ($conditionSql ? ' WHERE ' . $conditionSql : ''); $where = ($conditionSql ? ' WHERE ' . $conditionSql : '');
$lock = $this->platform->appendLockHint($from, $lockMode);
$query = $select
. $lock
. $join
. $where
. $orderBySql;
return $this->platform->modifyLimitQuery($select return $this->platform->modifyLimitQuery($query, $limit, $offset) . $lockSql;
. $this->platform->appendLockHint($from, $lockMode)
. $join
. $where
. $orderBySql, $limit, $offset)
. $lockSql;
} }
/** /**