1
0
mirror of synced 2025-02-13 10:49:25 +03:00

Fixed many small phpcs issues

This commit is contained in:
Jeroen Thora 2014-12-19 22:27:26 +01:00 committed by Marco Pivetta
parent 3971e8c55b
commit 6dcb97a20e
80 changed files with 358 additions and 294 deletions

View File

@ -178,7 +178,6 @@ abstract class AbstractQuery
} }
/** /**
*
* Enable/disable second level query (result) caching for this query. * Enable/disable second level query (result) caching for this query.
* *
* @param boolean $cacheable * @param boolean $cacheable
@ -243,7 +242,7 @@ abstract class AbstractQuery
* *
* @param integer $lifetime * @param integer $lifetime
* *
* @return static This query instance. * @return \Doctrine\ORM\AbstractQuery This query instance.
*/ */
public function setLifetime($lifetime) public function setLifetime($lifetime)
{ {
@ -263,7 +262,7 @@ abstract class AbstractQuery
/** /**
* @param integer $cacheMode * @param integer $cacheMode
* *
* @return static This query instance. * @return \Doctrine\ORM\AbstractQuery This query instance.
*/ */
public function setCacheMode($cacheMode) public function setCacheMode($cacheMode)
{ {

View File

@ -58,6 +58,8 @@ class AssociationCacheEntry implements CacheEntry
* This method allow Doctrine\Common\Cache\PhpFileCache compatibility * This method allow Doctrine\Common\Cache\PhpFileCache compatibility
* *
* @param array $values array containing property values * @param array $values array containing property values
*
* @return AssociationCacheEntry
*/ */
public static function __set_state(array $values) public static function __set_state(array $values)
{ {

View File

@ -62,8 +62,9 @@ class CacheException extends ORMException
/** /**
* @param string $entityName * @param string $entityName
* @param string $field
* *
* @return \Doctrine\ORM\Cache\CacheException * @return CacheException
*/ */
public static function nonCacheableEntityAssociation($entityName, $field) public static function nonCacheableEntityAssociation($entityName, $field)
{ {

View File

@ -50,7 +50,7 @@ class CollectionCacheEntry implements CacheEntry
* *
* @param array $values array containing property values * @param array $values array containing property values
* *
* @return self * @return CollectionCacheEntry
*/ */
public static function __set_state(array $values) public static function __set_state(array $values)
{ {

View File

@ -60,6 +60,8 @@ class EntityCacheEntry implements CacheEntry
* This method allow Doctrine\Common\Cache\PhpFileCache compatibility * This method allow Doctrine\Common\Cache\PhpFileCache compatibility
* *
* @param array $values array containing property values * @param array $values array containing property values
*
* @return EntityCacheEntry
*/ */
public static function __set_state(array $values) public static function __set_state(array $values)
{ {

View File

@ -40,6 +40,7 @@ interface CachedEntityPersister extends CachedPersister, EntityPersister
/** /**
* @param object $entity * @param object $entity
* @param \Doctrine\ORM\Cache\EntityCacheKey $key * @param \Doctrine\ORM\Cache\EntityCacheKey $key
*
* @return boolean * @return boolean
*/ */
public function storeEntityCache($entity, EntityCacheKey $key); public function storeEntityCache($entity, EntityCacheKey $key);

View File

@ -54,6 +54,8 @@ class QueryCacheEntry implements CacheEntry
/** /**
* @param array $values * @param array $values
*
* @return QueryCacheEntry
*/ */
public static function __set_state(array $values) public static function __set_state(array $values)
{ {

View File

@ -114,7 +114,7 @@ class FileLockRegion implements ConcurrentRegion
/** /**
* @param \Doctrine\ORM\Cache\CacheKey $key * @param \Doctrine\ORM\Cache\CacheKey $key
* *
* return string * @return string
*/ */
private function getLockFileName(CacheKey $key) private function getLockFileName(CacheKey $key)
{ {
@ -124,7 +124,7 @@ class FileLockRegion implements ConcurrentRegion
/** /**
* @param string $filename * @param string $filename
* *
* return string * @return string
*/ */
private function getLockContent($filename) private function getLockContent($filename)
{ {
@ -134,7 +134,7 @@ class FileLockRegion implements ConcurrentRegion
/** /**
* @param string $filename * @param string $filename
* *
* return integer * @return integer
*/ */
private function getLockTime($filename) private function getLockTime($filename)
{ {
@ -142,7 +142,7 @@ class FileLockRegion implements ConcurrentRegion
} }
/** /**
* {inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName()
{ {
@ -150,7 +150,7 @@ class FileLockRegion implements ConcurrentRegion
} }
/** /**
* {inheritdoc} * {@inheritdoc}
*/ */
public function contains(CacheKey $key) public function contains(CacheKey $key)
{ {
@ -162,7 +162,7 @@ class FileLockRegion implements ConcurrentRegion
} }
/** /**
* {inheritdoc} * {@inheritdoc}
*/ */
public function get(CacheKey $key) public function get(CacheKey $key)
{ {
@ -186,7 +186,7 @@ class FileLockRegion implements ConcurrentRegion
} }
/** /**
* {inheritdoc} * {@inheritdoc}
*/ */
public function put(CacheKey $key, CacheEntry $entry, Lock $lock = null) public function put(CacheKey $key, CacheEntry $entry, Lock $lock = null)
{ {
@ -198,7 +198,7 @@ class FileLockRegion implements ConcurrentRegion
} }
/** /**
* {inheritdoc} * {@inheritdoc}
*/ */
public function evict(CacheKey $key) public function evict(CacheKey $key)
{ {
@ -210,7 +210,7 @@ class FileLockRegion implements ConcurrentRegion
} }
/** /**
* {inheritdoc} * {@inheritdoc}
*/ */
public function evictAll() public function evictAll()
{ {
@ -228,7 +228,7 @@ class FileLockRegion implements ConcurrentRegion
} }
/** /**
* {inheritdoc} * {@inheritdoc}
*/ */
public function lock(CacheKey $key) public function lock(CacheKey $key)
{ {
@ -248,7 +248,7 @@ class FileLockRegion implements ConcurrentRegion
} }
/** /**
* {inheritdoc} * {@inheritdoc}
*/ */
public function unlock(CacheKey $key, Lock $lock) public function unlock(CacheKey $key, Lock $lock)
{ {

View File

@ -40,7 +40,7 @@ class TimestampCacheEntry implements CacheEntry
*/ */
public function __construct($time = null) public function __construct($time = null)
{ {
$this->time = $time ? (float)$time : microtime(true); $this->time = $time ? (float) $time : microtime(true);
} }
/** /**
@ -49,6 +49,8 @@ class TimestampCacheEntry implements CacheEntry
* This method allow Doctrine\Common\Cache\PhpFileCache compatibility * This method allow Doctrine\Common\Cache\PhpFileCache compatibility
* *
* @param array $values array containing property values * @param array $values array containing property values
*
* @return TimestampCacheEntry
*/ */
public static function __set_state(array $values) public static function __set_state(array $values)
{ {

View File

@ -98,7 +98,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
*/ */
public function setAutoGenerateProxyClasses($autoGenerate) public function setAutoGenerateProxyClasses($autoGenerate)
{ {
$this->_attributes['autoGenerateProxyClasses'] = (int)$autoGenerate; $this->_attributes['autoGenerateProxyClasses'] = (int) $autoGenerate;
} }
/** /**

View File

@ -571,7 +571,7 @@ use Doctrine\Common\Util\ClassUtils;
public function persist($entity) public function persist($entity)
{ {
if ( ! is_object($entity)) { if ( ! is_object($entity)) {
throw ORMInvalidArgumentException::invalidObject('EntityManager#persist()' , $entity); throw ORMInvalidArgumentException::invalidObject('EntityManager#persist()', $entity);
} }
$this->errorIfClosed(); $this->errorIfClosed();
@ -594,7 +594,7 @@ use Doctrine\Common\Util\ClassUtils;
public function remove($entity) public function remove($entity)
{ {
if ( ! is_object($entity)) { if ( ! is_object($entity)) {
throw ORMInvalidArgumentException::invalidObject('EntityManager#remove()' , $entity); throw ORMInvalidArgumentException::invalidObject('EntityManager#remove()', $entity);
} }
$this->errorIfClosed(); $this->errorIfClosed();
@ -615,7 +615,7 @@ use Doctrine\Common\Util\ClassUtils;
public function refresh($entity) public function refresh($entity)
{ {
if ( ! is_object($entity)) { if ( ! is_object($entity)) {
throw ORMInvalidArgumentException::invalidObject('EntityManager#refresh()' , $entity); throw ORMInvalidArgumentException::invalidObject('EntityManager#refresh()', $entity);
} }
$this->errorIfClosed(); $this->errorIfClosed();
@ -639,7 +639,7 @@ use Doctrine\Common\Util\ClassUtils;
public function detach($entity) public function detach($entity)
{ {
if ( ! is_object($entity)) { if ( ! is_object($entity)) {
throw ORMInvalidArgumentException::invalidObject('EntityManager#detach()' , $entity); throw ORMInvalidArgumentException::invalidObject('EntityManager#detach()', $entity);
} }
$this->unitOfWork->detach($entity); $this->unitOfWork->detach($entity);
@ -659,7 +659,7 @@ use Doctrine\Common\Util\ClassUtils;
public function merge($entity) public function merge($entity)
{ {
if ( ! is_object($entity)) { if ( ! is_object($entity)) {
throw ORMInvalidArgumentException::invalidObject('EntityManager#merge()' , $entity); throw ORMInvalidArgumentException::invalidObject('EntityManager#merge()', $entity);
} }
$this->errorIfClosed(); $this->errorIfClosed();

View File

@ -97,13 +97,13 @@ class ListenersInvoker
*/ */
public function invoke(ClassMetadata $metadata, $eventName, $entity, EventArgs $event, $invoke) public function invoke(ClassMetadata $metadata, $eventName, $entity, EventArgs $event, $invoke)
{ {
if($invoke & self::INVOKE_CALLBACKS) { if ($invoke & self::INVOKE_CALLBACKS) {
foreach ($metadata->lifecycleCallbacks[$eventName] as $callback) { foreach ($metadata->lifecycleCallbacks[$eventName] as $callback) {
$entity->$callback($event); $entity->$callback($event);
} }
} }
if($invoke & self::INVOKE_LISTENERS) { if ($invoke & self::INVOKE_LISTENERS) {
foreach ($metadata->entityListeners[$eventName] as $listener) { foreach ($metadata->entityListeners[$eventName] as $listener) {
$class = $listener['class']; $class = $listener['class'];
$method = $listener['method']; $method = $listener['method'];
@ -113,7 +113,7 @@ class ListenersInvoker
} }
} }
if($invoke & self::INVOKE_MANAGER) { if ($invoke & self::INVOKE_MANAGER) {
$this->eventManager->dispatchEvent($eventName, $event); $this->eventManager->dispatchEvent($eventName, $event);
} }
} }

View File

@ -52,7 +52,7 @@ class IdentityGenerator extends AbstractIdGenerator
*/ */
public function generate(EntityManager $em, $entity) public function generate(EntityManager $em, $entity)
{ {
return (int)$em->getConnection()->lastInsertId($this->sequenceName); return (int) $em->getConnection()->lastInsertId($this->sequenceName);
} }
/** /**

View File

@ -76,7 +76,7 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
$conn = $em->getConnection(); $conn = $em->getConnection();
$sql = $conn->getDatabasePlatform()->getSequenceNextValSQL($this->_sequenceName); $sql = $conn->getDatabasePlatform()->getSequenceNextValSQL($this->_sequenceName);
$this->_nextValue = (int)$conn->fetchColumn($sql); $this->_nextValue = (int) $conn->fetchColumn($sql);
$this->_maxValue = $this->_nextValue + $this->_allocationSize; $this->_maxValue = $this->_nextValue + $this->_allocationSize;
} }

View File

@ -36,6 +36,7 @@ class UuidGenerator extends AbstractIdGenerator
{ {
$conn = $em->getConnection(); $conn = $em->getConnection();
$sql = 'SELECT ' . $conn->getDatabasePlatform()->getGuidExpression(); $sql = 'SELECT ' . $conn->getDatabasePlatform()->getGuidExpression();
return $conn->query($sql)->fetchColumn(0); return $conn->query($sql)->fetchColumn(0);
} }
} }

View File

@ -80,6 +80,7 @@ class IterableResult implements \Iterator
{ {
$this->_current = $this->_hydrator->hydrateRow(); $this->_current = $this->_hydrator->hydrateRow();
$this->_key++; $this->_key++;
return $this->_current; return $this->_current;
} }

View File

@ -100,6 +100,7 @@ class LazyCriteriaCollection extends AbstractLazyCollection implements Selectabl
* Do an optimized search of an element * Do an optimized search of an element
* *
* @param object $element * @param object $element
*
* @return bool * @return bool
*/ */
public function contains($element) public function contains($element)

View File

@ -63,6 +63,7 @@ class AssociationBuilder
public function mappedBy($fieldName) public function mappedBy($fieldName)
{ {
$this->mapping['mappedBy'] = $fieldName; $this->mapping['mappedBy'] = $fieldName;
return $this; return $this;
} }
@ -74,6 +75,7 @@ class AssociationBuilder
public function inversedBy($fieldName) public function inversedBy($fieldName)
{ {
$this->mapping['inversedBy'] = $fieldName; $this->mapping['inversedBy'] = $fieldName;
return $this; return $this;
} }
@ -83,6 +85,7 @@ class AssociationBuilder
public function cascadeAll() public function cascadeAll()
{ {
$this->mapping['cascade'] = array("ALL"); $this->mapping['cascade'] = array("ALL");
return $this; return $this;
} }
@ -92,6 +95,7 @@ class AssociationBuilder
public function cascadePersist() public function cascadePersist()
{ {
$this->mapping['cascade'][] = "persist"; $this->mapping['cascade'][] = "persist";
return $this; return $this;
} }
@ -101,6 +105,7 @@ class AssociationBuilder
public function cascadeRemove() public function cascadeRemove()
{ {
$this->mapping['cascade'][] = "remove"; $this->mapping['cascade'][] = "remove";
return $this; return $this;
} }
@ -110,6 +115,7 @@ class AssociationBuilder
public function cascadeMerge() public function cascadeMerge()
{ {
$this->mapping['cascade'][] = "merge"; $this->mapping['cascade'][] = "merge";
return $this; return $this;
} }
@ -119,6 +125,7 @@ class AssociationBuilder
public function cascadeDetach() public function cascadeDetach()
{ {
$this->mapping['cascade'][] = "detach"; $this->mapping['cascade'][] = "detach";
return $this; return $this;
} }
@ -128,6 +135,7 @@ class AssociationBuilder
public function cascadeRefresh() public function cascadeRefresh()
{ {
$this->mapping['cascade'][] = "refresh"; $this->mapping['cascade'][] = "refresh";
return $this; return $this;
} }
@ -137,6 +145,7 @@ class AssociationBuilder
public function fetchExtraLazy() public function fetchExtraLazy()
{ {
$this->mapping['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY; $this->mapping['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
return $this; return $this;
} }
@ -146,6 +155,7 @@ class AssociationBuilder
public function fetchEager() public function fetchEager()
{ {
$this->mapping['fetch'] = ClassMetadata::FETCH_EAGER; $this->mapping['fetch'] = ClassMetadata::FETCH_EAGER;
return $this; return $this;
} }
@ -155,6 +165,7 @@ class AssociationBuilder
public function fetchLazy() public function fetchLazy()
{ {
$this->mapping['fetch'] = ClassMetadata::FETCH_LAZY; $this->mapping['fetch'] = ClassMetadata::FETCH_LAZY;
return $this; return $this;
} }
@ -180,6 +191,7 @@ class AssociationBuilder
'onDelete' => $onDelete, 'onDelete' => $onDelete,
'columnDefinition' => $columnDef, 'columnDefinition' => $columnDef,
); );
return $this; return $this;
} }
@ -226,6 +238,7 @@ class AssociationBuilder
} else { } else {
throw new \InvalidArgumentException("Type should be a ToOne Association here"); throw new \InvalidArgumentException("Type should be a ToOne Association here");
} }
return $this->builder; return $this->builder;
} }
} }

View File

@ -79,6 +79,7 @@ class FieldBuilder
public function length($length) public function length($length)
{ {
$this->mapping['length'] = $length; $this->mapping['length'] = $length;
return $this; return $this;
} }
@ -91,7 +92,8 @@ class FieldBuilder
*/ */
public function nullable($flag = true) public function nullable($flag = true)
{ {
$this->mapping['nullable'] = (bool)$flag; $this->mapping['nullable'] = (bool) $flag;
return $this; return $this;
} }
@ -104,7 +106,8 @@ class FieldBuilder
*/ */
public function unique($flag = true) public function unique($flag = true)
{ {
$this->mapping['unique'] = (bool)$flag; $this->mapping['unique'] = (bool) $flag;
return $this; return $this;
} }
@ -118,6 +121,7 @@ class FieldBuilder
public function columnName($name) public function columnName($name)
{ {
$this->mapping['columnName'] = $name; $this->mapping['columnName'] = $name;
return $this; return $this;
} }
@ -131,6 +135,7 @@ class FieldBuilder
public function precision($p) public function precision($p)
{ {
$this->mapping['precision'] = $p; $this->mapping['precision'] = $p;
return $this; return $this;
} }
@ -144,6 +149,7 @@ class FieldBuilder
public function scale($s) public function scale($s)
{ {
$this->mapping['scale'] = $s; $this->mapping['scale'] = $s;
return $this; return $this;
} }
@ -166,6 +172,7 @@ class FieldBuilder
public function makePrimaryKey() public function makePrimaryKey()
{ {
$this->mapping['id'] = true; $this->mapping['id'] = true;
return $this; return $this;
} }
@ -180,6 +187,7 @@ class FieldBuilder
public function option($name, $value) public function option($name, $value)
{ {
$this->mapping['options'][$name] = $value; $this->mapping['options'][$name] = $value;
return $this; return $this;
} }
@ -191,6 +199,7 @@ class FieldBuilder
public function generatedValue($strategy = 'AUTO') public function generatedValue($strategy = 'AUTO')
{ {
$this->generatedValue = $strategy; $this->generatedValue = $strategy;
return $this; return $this;
} }
@ -202,6 +211,7 @@ class FieldBuilder
public function isVersionField() public function isVersionField()
{ {
$this->version = true; $this->version = true;
return $this; return $this;
} }
@ -221,6 +231,7 @@ class FieldBuilder
'allocationSize' => $allocationSize, 'allocationSize' => $allocationSize,
'initialValue' => $initialValue, 'initialValue' => $initialValue,
); );
return $this; return $this;
} }
@ -234,6 +245,7 @@ class FieldBuilder
public function columnDefinition($def) public function columnDefinition($def)
{ {
$this->mapping['columnDefinition'] = $def; $this->mapping['columnDefinition'] = $def;
return $this; return $this;
} }

View File

@ -47,6 +47,7 @@ class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
public function setJoinTable($name) public function setJoinTable($name)
{ {
$this->joinTableName = $name; $this->joinTableName = $name;
return $this; return $this;
} }
@ -72,6 +73,7 @@ class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
'onDelete' => $onDelete, 'onDelete' => $onDelete,
'columnDefinition' => $columnDef, 'columnDefinition' => $columnDef,
); );
return $this; return $this;
} }
@ -93,6 +95,7 @@ class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
} }
$cm = $this->builder->getClassMetadata(); $cm = $this->builder->getClassMetadata();
$cm->mapManyToMany($mapping); $cm->mapManyToMany($mapping);
return $this->builder; return $this->builder;
} }
} }

View File

@ -37,6 +37,7 @@ class OneToManyAssociationBuilder extends AssociationBuilder
public function setOrderBy(array $fieldNames) public function setOrderBy(array $fieldNames)
{ {
$this->mapping['orderBy'] = $fieldNames; $this->mapping['orderBy'] = $fieldNames;
return $this; return $this;
} }
@ -48,6 +49,7 @@ class OneToManyAssociationBuilder extends AssociationBuilder
public function setIndexBy($fieldName) public function setIndexBy($fieldName)
{ {
$this->mapping['indexBy'] = $fieldName; $this->mapping['indexBy'] = $fieldName;
return $this; return $this;
} }
@ -62,6 +64,7 @@ class OneToManyAssociationBuilder extends AssociationBuilder
} }
$cm = $this->builder->getClassMetadata(); $cm = $this->builder->getClassMetadata();
$cm->mapOneToMany($mapping); $cm->mapOneToMany($mapping);
return $this->builder; return $this->builder;
} }
} }

View File

@ -386,6 +386,7 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
} }
$parts = explode("\\", $className); $parts = explode("\\", $className);
return strtolower(end($parts)); return strtolower(end($parts));
} }

View File

@ -698,6 +698,7 @@ class ClassMetadataInfo implements ClassMetadata
if ($this->isIdentifierComposite) { if ($this->isIdentifierComposite) {
throw new BadMethodCallException("Class " . $this->name . " has a composite identifier."); throw new BadMethodCallException("Class " . $this->name . " has a composite identifier.");
} }
return $this->reflFields[$this->identifier[0]]; return $this->reflFields[$this->identifier[0]];
} }
@ -3248,6 +3249,7 @@ class ClassMetadataInfo implements ClassMetadata
/** /**
* @param string|null $className * @param string|null $className
*
* @return string|null null if the input value is null * @return string|null null if the input value is null
*/ */
public function fullyQualifiedClassName($className) public function fullyQualifiedClassName($className)
@ -3268,7 +3270,8 @@ class ClassMetadataInfo implements ClassMetadata
* *
* @return mixed * @return mixed
*/ */
public function getMetadataValue($name) { public function getMetadataValue($name)
{
if (isset($this->$name)) { if (isset($this->$name)) {
return $this->$name; return $this->$name;
@ -3281,6 +3284,7 @@ class ClassMetadataInfo implements ClassMetadata
* Map Embedded Class * Map Embedded Class
* *
* @param array $mapping * @param array $mapping
*
* @throws MappingException * @throws MappingException
* @return void * @return void
*/ */

View File

@ -526,7 +526,7 @@ class AnnotationDriver extends AbstractAnnotationDriver
*/ */
private function getFetchMode($className, $fetchMode) private function getFetchMode($className, $fetchMode)
{ {
if( ! defined('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $fetchMode)) { if ( ! defined('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $fetchMode)) {
throw MappingException::invalidFetchMode($className, $fetchMode); throw MappingException::invalidFetchMode($className, $fetchMode);
} }

View File

@ -319,7 +319,7 @@ class DatabaseDriver implements MappingDriver
$tableName = $metadata->table['name']; $tableName = $metadata->table['name'];
$indexes = $this->tables[$tableName]->getIndexes(); $indexes = $this->tables[$tableName]->getIndexes();
foreach($indexes as $index){ foreach ($indexes as $index) {
if ($index->isPrimary()) { if ($index->isPrimary()) {
continue; continue;
} }
@ -506,7 +506,7 @@ class DatabaseDriver implements MappingDriver
{ {
try { try {
return $table->getPrimaryKey()->getColumns(); return $table->getPrimaryKey()->getColumns();
} catch(SchemaException $e) { } catch (SchemaException $e) {
// Do nothing // Do nothing
} }
@ -550,6 +550,7 @@ class DatabaseDriver implements MappingDriver
if ($fk) { if ($fk) {
$columnName = str_replace('_id', '', $columnName); $columnName = str_replace('_id', '', $columnName);
} }
return Inflector::camelize($columnName); return Inflector::camelize($columnName);
} }
} }

View File

@ -59,14 +59,14 @@ class XmlDriver extends FileDriver
if ($xmlRoot->getName() == 'entity') { if ($xmlRoot->getName() == 'entity') {
if (isset($xmlRoot['repository-class'])) { if (isset($xmlRoot['repository-class'])) {
$metadata->setCustomRepositoryClass((string)$xmlRoot['repository-class']); $metadata->setCustomRepositoryClass((string) $xmlRoot['repository-class']);
} }
if (isset($xmlRoot['read-only']) && $this->evaluateBoolean($xmlRoot['read-only'])) { if (isset($xmlRoot['read-only']) && $this->evaluateBoolean($xmlRoot['read-only'])) {
$metadata->markReadOnly(); $metadata->markReadOnly();
} }
} else if ($xmlRoot->getName() == 'mapped-superclass') { } else if ($xmlRoot->getName() == 'mapped-superclass') {
$metadata->setCustomRepositoryClass( $metadata->setCustomRepositoryClass(
isset($xmlRoot['repository-class']) ? (string)$xmlRoot['repository-class'] : null isset($xmlRoot['repository-class']) ? (string) $xmlRoot['repository-class'] : null
); );
$metadata->isMappedSuperclass = true; $metadata->isMappedSuperclass = true;
} else if ($xmlRoot->getName() == 'embeddable') { } else if ($xmlRoot->getName() == 'embeddable') {
@ -97,8 +97,8 @@ class XmlDriver extends FileDriver
if (isset($xmlRoot->{'named-queries'})) { if (isset($xmlRoot->{'named-queries'})) {
foreach ($xmlRoot->{'named-queries'}->{'named-query'} as $namedQueryElement) { foreach ($xmlRoot->{'named-queries'}->{'named-query'} as $namedQueryElement) {
$metadata->addNamedQuery(array( $metadata->addNamedQuery(array(
'name' => (string)$namedQueryElement['name'], 'name' => (string) $namedQueryElement['name'],
'query' => (string)$namedQueryElement['query'] 'query' => (string) $namedQueryElement['query']
)); ));
} }
} }
@ -107,10 +107,10 @@ class XmlDriver extends FileDriver
if (isset($xmlRoot->{'named-native-queries'})) { if (isset($xmlRoot->{'named-native-queries'})) {
foreach ($xmlRoot->{'named-native-queries'}->{'named-native-query'} as $nativeQueryElement) { foreach ($xmlRoot->{'named-native-queries'}->{'named-native-query'} as $nativeQueryElement) {
$metadata->addNamedNativeQuery(array( $metadata->addNamedNativeQuery(array(
'name' => isset($nativeQueryElement['name']) ? (string)$nativeQueryElement['name'] : null, 'name' => isset($nativeQueryElement['name']) ? (string) $nativeQueryElement['name'] : null,
'query' => isset($nativeQueryElement->query) ? (string)$nativeQueryElement->query : null, 'query' => isset($nativeQueryElement->query) ? (string) $nativeQueryElement->query : null,
'resultClass' => isset($nativeQueryElement['result-class']) ? (string)$nativeQueryElement['result-class'] : null, 'resultClass' => isset($nativeQueryElement['result-class']) ? (string) $nativeQueryElement['result-class'] : null,
'resultSetMapping' => isset($nativeQueryElement['result-set-mapping']) ? (string)$nativeQueryElement['result-set-mapping'] : null, 'resultSetMapping' => isset($nativeQueryElement['result-set-mapping']) ? (string) $nativeQueryElement['result-set-mapping'] : null,
)); ));
} }
} }
@ -125,14 +125,14 @@ class XmlDriver extends FileDriver
if (isset($entityElement['entity-class'])) { if (isset($entityElement['entity-class'])) {
$entityResult = array( $entityResult = array(
'fields' => array(), 'fields' => array(),
'entityClass' => (string)$entityElement['entity-class'], 'entityClass' => (string) $entityElement['entity-class'],
'discriminatorColumn' => isset($entityElement['discriminator-column']) ? (string)$entityElement['discriminator-column'] : null, 'discriminatorColumn' => isset($entityElement['discriminator-column']) ? (string) $entityElement['discriminator-column'] : null,
); );
foreach ($entityElement as $fieldElement) { foreach ($entityElement as $fieldElement) {
$entityResult['fields'][] = array( $entityResult['fields'][] = array(
'name' => isset($fieldElement['name']) ? (string)$fieldElement['name'] : null, 'name' => isset($fieldElement['name']) ? (string) $fieldElement['name'] : null,
'column' => isset($fieldElement['column']) ? (string)$fieldElement['column'] : null, 'column' => isset($fieldElement['column']) ? (string) $fieldElement['column'] : null,
); );
} }
@ -142,13 +142,13 @@ class XmlDriver extends FileDriver
//<column-result/> //<column-result/>
if (isset($entityElement['name'])) { if (isset($entityElement['name'])) {
$columns[] = array( $columns[] = array(
'name' => (string)$entityElement['name'], 'name' => (string) $entityElement['name'],
); );
} }
} }
$metadata->addSqlResultSetMapping(array( $metadata->addSqlResultSetMapping(array(
'name' => (string)$rsmElement['name'], 'name' => (string) $rsmElement['name'],
'entities' => $entities, 'entities' => $entities,
'columns' => $columns 'columns' => $columns
)); ));
@ -156,7 +156,7 @@ class XmlDriver extends FileDriver
} }
if (isset($xmlRoot['inheritance-type'])) { if (isset($xmlRoot['inheritance-type'])) {
$inheritanceType = (string)$xmlRoot['inheritance-type']; $inheritanceType = (string) $xmlRoot['inheritance-type'];
$metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceType)); $metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceType));
if ($metadata->inheritanceType != \Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_NONE) { if ($metadata->inheritanceType != \Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_NONE) {
@ -164,10 +164,10 @@ class XmlDriver extends FileDriver
if (isset($xmlRoot->{'discriminator-column'})) { if (isset($xmlRoot->{'discriminator-column'})) {
$discrColumn = $xmlRoot->{'discriminator-column'}; $discrColumn = $xmlRoot->{'discriminator-column'};
$metadata->setDiscriminatorColumn(array( $metadata->setDiscriminatorColumn(array(
'name' => isset($discrColumn['name']) ? (string)$discrColumn['name'] : null, 'name' => isset($discrColumn['name']) ? (string) $discrColumn['name'] : null,
'type' => isset($discrColumn['type']) ? (string)$discrColumn['type'] : null, 'type' => isset($discrColumn['type']) ? (string) $discrColumn['type'] : null,
'length' => isset($discrColumn['length']) ? (string)$discrColumn['length'] : null, 'length' => isset($discrColumn['length']) ? (string) $discrColumn['length'] : null,
'columnDefinition' => isset($discrColumn['column-definition']) ? (string)$discrColumn['column-definition'] : null 'columnDefinition' => isset($discrColumn['column-definition']) ? (string) $discrColumn['column-definition'] : null
)); ));
} else { } else {
$metadata->setDiscriminatorColumn(array('name' => 'dtype', 'type' => 'string', 'length' => 255)); $metadata->setDiscriminatorColumn(array('name' => 'dtype', 'type' => 'string', 'length' => 255));
@ -177,7 +177,7 @@ class XmlDriver extends FileDriver
if (isset($xmlRoot->{'discriminator-map'})) { if (isset($xmlRoot->{'discriminator-map'})) {
$map = array(); $map = array();
foreach ($xmlRoot->{'discriminator-map'}->{'discriminator-mapping'} as $discrMapElement) { foreach ($xmlRoot->{'discriminator-map'}->{'discriminator-mapping'} as $discrMapElement) {
$map[(string)$discrMapElement['value']] = (string)$discrMapElement['class']; $map[(string) $discrMapElement['value']] = (string) $discrMapElement['class'];
} }
$metadata->setDiscriminatorMap($map); $metadata->setDiscriminatorMap($map);
} }
@ -188,7 +188,7 @@ class XmlDriver extends FileDriver
// Evaluate <change-tracking-policy...> // Evaluate <change-tracking-policy...>
if (isset($xmlRoot['change-tracking-policy'])) { if (isset($xmlRoot['change-tracking-policy'])) {
$metadata->setChangeTrackingPolicy(constant('Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_' $metadata->setChangeTrackingPolicy(constant('Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_'
. strtoupper((string)$xmlRoot['change-tracking-policy']))); . strtoupper((string) $xmlRoot['change-tracking-policy'])));
} }
// Evaluate <indexes...> // Evaluate <indexes...>
@ -225,7 +225,7 @@ class XmlDriver extends FileDriver
} }
if (isset($uniqueXml['name'])) { if (isset($uniqueXml['name'])) {
$metadata->table['uniqueConstraints'][(string)$uniqueXml['name']] = $unique; $metadata->table['uniqueConstraints'][(string) $uniqueXml['name']] = $unique;
} else { } else {
$metadata->table['uniqueConstraints'][] = $unique; $metadata->table['uniqueConstraints'][] = $unique;
} }
@ -285,29 +285,29 @@ class XmlDriver extends FileDriver
$associationIds = array(); $associationIds = array();
foreach ($xmlRoot->id as $idElement) { foreach ($xmlRoot->id as $idElement) {
if (isset($idElement['association-key']) && $this->evaluateBoolean($idElement['association-key'])) { if (isset($idElement['association-key']) && $this->evaluateBoolean($idElement['association-key'])) {
$associationIds[(string)$idElement['name']] = true; $associationIds[(string) $idElement['name']] = true;
continue; continue;
} }
$mapping = array( $mapping = array(
'id' => true, 'id' => true,
'fieldName' => (string)$idElement['name'] 'fieldName' => (string) $idElement['name']
); );
if (isset($idElement['type'])) { if (isset($idElement['type'])) {
$mapping['type'] = (string)$idElement['type']; $mapping['type'] = (string) $idElement['type'];
} }
if (isset($idElement['length'])) { if (isset($idElement['length'])) {
$mapping['length'] = (string)$idElement['length']; $mapping['length'] = (string) $idElement['length'];
} }
if (isset($idElement['column'])) { if (isset($idElement['column'])) {
$mapping['columnName'] = (string)$idElement['column']; $mapping['columnName'] = (string) $idElement['column'];
} }
if (isset($idElement['column-definition'])) { if (isset($idElement['column-definition'])) {
$mapping['columnDefinition'] = (string)$idElement['column-definition']; $mapping['columnDefinition'] = (string) $idElement['column-definition'];
} }
if (isset($idElement->options)) { if (isset($idElement->options)) {
@ -318,7 +318,7 @@ class XmlDriver extends FileDriver
if (isset($idElement->generator)) { if (isset($idElement->generator)) {
$strategy = isset($idElement->generator['strategy']) ? $strategy = isset($idElement->generator['strategy']) ?
(string)$idElement->generator['strategy'] : 'AUTO'; (string) $idElement->generator['strategy'] : 'AUTO';
$metadata->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_' $metadata->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_'
. $strategy)); . $strategy));
} }
@ -327,9 +327,9 @@ class XmlDriver extends FileDriver
if (isset($idElement->{'sequence-generator'})) { if (isset($idElement->{'sequence-generator'})) {
$seqGenerator = $idElement->{'sequence-generator'}; $seqGenerator = $idElement->{'sequence-generator'};
$metadata->setSequenceGeneratorDefinition(array( $metadata->setSequenceGeneratorDefinition(array(
'sequenceName' => (string)$seqGenerator['sequence-name'], 'sequenceName' => (string) $seqGenerator['sequence-name'],
'allocationSize' => (string)$seqGenerator['allocation-size'], 'allocationSize' => (string) $seqGenerator['allocation-size'],
'initialValue' => (string)$seqGenerator['initial-value'] 'initialValue' => (string) $seqGenerator['initial-value']
)); ));
} else if (isset($idElement->{'custom-id-generator'})) { } else if (isset($idElement->{'custom-id-generator'})) {
$customGenerator = $idElement->{'custom-id-generator'}; $customGenerator = $idElement->{'custom-id-generator'};
@ -345,8 +345,8 @@ class XmlDriver extends FileDriver
if (isset($xmlRoot->{'one-to-one'})) { if (isset($xmlRoot->{'one-to-one'})) {
foreach ($xmlRoot->{'one-to-one'} as $oneToOneElement) { foreach ($xmlRoot->{'one-to-one'} as $oneToOneElement) {
$mapping = array( $mapping = array(
'fieldName' => (string)$oneToOneElement['field'], 'fieldName' => (string) $oneToOneElement['field'],
'targetEntity' => (string)$oneToOneElement['target-entity'] 'targetEntity' => (string) $oneToOneElement['target-entity']
); );
if (isset($associationIds[$mapping['fieldName']])) { if (isset($associationIds[$mapping['fieldName']])) {
@ -354,14 +354,14 @@ class XmlDriver extends FileDriver
} }
if (isset($oneToOneElement['fetch'])) { if (isset($oneToOneElement['fetch'])) {
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string)$oneToOneElement['fetch']); $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $oneToOneElement['fetch']);
} }
if (isset($oneToOneElement['mapped-by'])) { if (isset($oneToOneElement['mapped-by'])) {
$mapping['mappedBy'] = (string)$oneToOneElement['mapped-by']; $mapping['mappedBy'] = (string) $oneToOneElement['mapped-by'];
} else { } else {
if (isset($oneToOneElement['inversed-by'])) { if (isset($oneToOneElement['inversed-by'])) {
$mapping['inversedBy'] = (string)$oneToOneElement['inversed-by']; $mapping['inversedBy'] = (string) $oneToOneElement['inversed-by'];
} }
$joinColumns = array(); $joinColumns = array();
@ -397,13 +397,13 @@ class XmlDriver extends FileDriver
if (isset($xmlRoot->{'one-to-many'})) { if (isset($xmlRoot->{'one-to-many'})) {
foreach ($xmlRoot->{'one-to-many'} as $oneToManyElement) { foreach ($xmlRoot->{'one-to-many'} as $oneToManyElement) {
$mapping = array( $mapping = array(
'fieldName' => (string)$oneToManyElement['field'], 'fieldName' => (string) $oneToManyElement['field'],
'targetEntity' => (string)$oneToManyElement['target-entity'], 'targetEntity' => (string) $oneToManyElement['target-entity'],
'mappedBy' => (string)$oneToManyElement['mapped-by'] 'mappedBy' => (string) $oneToManyElement['mapped-by']
); );
if (isset($oneToManyElement['fetch'])) { if (isset($oneToManyElement['fetch'])) {
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string)$oneToManyElement['fetch']); $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $oneToManyElement['fetch']);
} }
if (isset($oneToManyElement->cascade)) { if (isset($oneToManyElement->cascade)) {
@ -417,13 +417,13 @@ class XmlDriver extends FileDriver
if (isset($oneToManyElement->{'order-by'})) { if (isset($oneToManyElement->{'order-by'})) {
$orderBy = array(); $orderBy = array();
foreach ($oneToManyElement->{'order-by'}->{'order-by-field'} as $orderByField) { foreach ($oneToManyElement->{'order-by'}->{'order-by-field'} as $orderByField) {
$orderBy[(string)$orderByField['name']] = (string)$orderByField['direction']; $orderBy[(string) $orderByField['name']] = (string) $orderByField['direction'];
} }
$mapping['orderBy'] = $orderBy; $mapping['orderBy'] = $orderBy;
} }
if (isset($oneToManyElement['index-by'])) { if (isset($oneToManyElement['index-by'])) {
$mapping['indexBy'] = (string)$oneToManyElement['index-by']; $mapping['indexBy'] = (string) $oneToManyElement['index-by'];
} else if (isset($oneToManyElement->{'index-by'})) { } else if (isset($oneToManyElement->{'index-by'})) {
throw new \InvalidArgumentException("<index-by /> is not a valid tag"); throw new \InvalidArgumentException("<index-by /> is not a valid tag");
} }
@ -441,8 +441,8 @@ class XmlDriver extends FileDriver
if (isset($xmlRoot->{'many-to-one'})) { if (isset($xmlRoot->{'many-to-one'})) {
foreach ($xmlRoot->{'many-to-one'} as $manyToOneElement) { foreach ($xmlRoot->{'many-to-one'} as $manyToOneElement) {
$mapping = array( $mapping = array(
'fieldName' => (string)$manyToOneElement['field'], 'fieldName' => (string) $manyToOneElement['field'],
'targetEntity' => (string)$manyToOneElement['target-entity'] 'targetEntity' => (string) $manyToOneElement['target-entity']
); );
if (isset($associationIds[$mapping['fieldName']])) { if (isset($associationIds[$mapping['fieldName']])) {
@ -450,11 +450,11 @@ class XmlDriver extends FileDriver
} }
if (isset($manyToOneElement['fetch'])) { if (isset($manyToOneElement['fetch'])) {
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string)$manyToOneElement['fetch']); $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $manyToOneElement['fetch']);
} }
if (isset($manyToOneElement['inversed-by'])) { if (isset($manyToOneElement['inversed-by'])) {
$mapping['inversedBy'] = (string)$manyToOneElement['inversed-by']; $mapping['inversedBy'] = (string) $manyToOneElement['inversed-by'];
} }
$joinColumns = array(); $joinColumns = array();
@ -487,12 +487,12 @@ class XmlDriver extends FileDriver
if (isset($xmlRoot->{'many-to-many'})) { if (isset($xmlRoot->{'many-to-many'})) {
foreach ($xmlRoot->{'many-to-many'} as $manyToManyElement) { foreach ($xmlRoot->{'many-to-many'} as $manyToManyElement) {
$mapping = array( $mapping = array(
'fieldName' => (string)$manyToManyElement['field'], 'fieldName' => (string) $manyToManyElement['field'],
'targetEntity' => (string)$manyToManyElement['target-entity'] 'targetEntity' => (string) $manyToManyElement['target-entity']
); );
if (isset($manyToManyElement['fetch'])) { if (isset($manyToManyElement['fetch'])) {
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string)$manyToManyElement['fetch']); $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $manyToManyElement['fetch']);
} }
if (isset($manyToManyElement['orphan-removal'])) { if (isset($manyToManyElement['orphan-removal'])) {
@ -500,19 +500,19 @@ class XmlDriver extends FileDriver
} }
if (isset($manyToManyElement['mapped-by'])) { if (isset($manyToManyElement['mapped-by'])) {
$mapping['mappedBy'] = (string)$manyToManyElement['mapped-by']; $mapping['mappedBy'] = (string) $manyToManyElement['mapped-by'];
} else if (isset($manyToManyElement->{'join-table'})) { } else if (isset($manyToManyElement->{'join-table'})) {
if (isset($manyToManyElement['inversed-by'])) { if (isset($manyToManyElement['inversed-by'])) {
$mapping['inversedBy'] = (string)$manyToManyElement['inversed-by']; $mapping['inversedBy'] = (string) $manyToManyElement['inversed-by'];
} }
$joinTableElement = $manyToManyElement->{'join-table'}; $joinTableElement = $manyToManyElement->{'join-table'};
$joinTable = array( $joinTable = array(
'name' => (string)$joinTableElement['name'] 'name' => (string) $joinTableElement['name']
); );
if (isset($joinTableElement['schema'])) { if (isset($joinTableElement['schema'])) {
$joinTable['schema'] = (string)$joinTableElement['schema']; $joinTable['schema'] = (string) $joinTableElement['schema'];
} }
foreach ($joinTableElement->{'join-columns'}->{'join-column'} as $joinColumnElement) { foreach ($joinTableElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
@ -533,13 +533,13 @@ class XmlDriver extends FileDriver
if (isset($manyToManyElement->{'order-by'})) { if (isset($manyToManyElement->{'order-by'})) {
$orderBy = array(); $orderBy = array();
foreach ($manyToManyElement->{'order-by'}->{'order-by-field'} as $orderByField) { foreach ($manyToManyElement->{'order-by'}->{'order-by-field'} as $orderByField) {
$orderBy[(string)$orderByField['name']] = (string)$orderByField['direction']; $orderBy[(string) $orderByField['name']] = (string) $orderByField['direction'];
} }
$mapping['orderBy'] = $orderBy; $mapping['orderBy'] = $orderBy;
} }
if (isset($manyToManyElement['index-by'])) { if (isset($manyToManyElement['index-by'])) {
$mapping['indexBy'] = (string)$manyToManyElement['index-by']; $mapping['indexBy'] = (string) $manyToManyElement['index-by'];
} else if (isset($manyToManyElement->{'index-by'})) { } else if (isset($manyToManyElement->{'index-by'})) {
throw new \InvalidArgumentException("<index-by /> is not a valid tag"); throw new \InvalidArgumentException("<index-by /> is not a valid tag");
} }
@ -617,7 +617,7 @@ class XmlDriver extends FileDriver
// Evaluate <lifecycle-callbacks...> // Evaluate <lifecycle-callbacks...>
if (isset($xmlRoot->{'lifecycle-callbacks'})) { if (isset($xmlRoot->{'lifecycle-callbacks'})) {
foreach ($xmlRoot->{'lifecycle-callbacks'}->{'lifecycle-callback'} as $lifecycleCallback) { foreach ($xmlRoot->{'lifecycle-callbacks'}->{'lifecycle-callback'} as $lifecycleCallback) {
$metadata->addLifecycleCallback((string)$lifecycleCallback['method'], constant('Doctrine\ORM\Events::' . (string)$lifecycleCallback['type'])); $metadata->addLifecycleCallback((string) $lifecycleCallback['method'], constant('Doctrine\ORM\Events::' . (string) $lifecycleCallback['type']));
} }
} }
@ -626,7 +626,7 @@ class XmlDriver extends FileDriver
foreach ($xmlRoot->{'entity-listeners'}->{'entity-listener'} as $listenerElement) { foreach ($xmlRoot->{'entity-listeners'}->{'entity-listener'} as $listenerElement) {
$className = (string) $listenerElement['class']; $className = (string) $listenerElement['class'];
// Evaluate the listener using naming convention. // Evaluate the listener using naming convention.
if($listenerElement->count() === 0) { if ($listenerElement->count() === 0) {
EntityListenerBuilder::bindEntityListener($metadata, $className); EntityListenerBuilder::bindEntityListener($metadata, $className);
continue; continue;
@ -684,8 +684,8 @@ class XmlDriver extends FileDriver
private function joinColumnToArray(SimpleXMLElement $joinColumnElement) private function joinColumnToArray(SimpleXMLElement $joinColumnElement)
{ {
$joinColumn = array( $joinColumn = array(
'name' => (string)$joinColumnElement['name'], 'name' => (string) $joinColumnElement['name'],
'referencedColumnName' => (string)$joinColumnElement['referenced-column-name'] 'referencedColumnName' => (string) $joinColumnElement['referenced-column-name']
); );
if (isset($joinColumnElement['unique'])) { if (isset($joinColumnElement['unique'])) {
@ -697,11 +697,11 @@ class XmlDriver extends FileDriver
} }
if (isset($joinColumnElement['on-delete'])) { if (isset($joinColumnElement['on-delete'])) {
$joinColumn['onDelete'] = (string)$joinColumnElement['on-delete']; $joinColumn['onDelete'] = (string) $joinColumnElement['on-delete'];
} }
if (isset($joinColumnElement['column-definition'])) { if (isset($joinColumnElement['column-definition'])) {
$joinColumn['columnDefinition'] = (string)$joinColumnElement['column-definition']; $joinColumn['columnDefinition'] = (string) $joinColumnElement['column-definition'];
} }
return $joinColumn; return $joinColumn;
@ -808,6 +808,7 @@ class XmlDriver extends FileDriver
// anything about the supported cascading actions // anything about the supported cascading actions
$cascades[] = str_replace('cascade-', '', $action->getName()); $cascades[] = str_replace('cascade-', '', $action->getName());
} }
return $cascades; return $cascades;
} }
@ -821,12 +822,12 @@ class XmlDriver extends FileDriver
if (isset($xmlElement->entity)) { if (isset($xmlElement->entity)) {
foreach ($xmlElement->entity as $entityElement) { foreach ($xmlElement->entity as $entityElement) {
$entityName = (string)$entityElement['name']; $entityName = (string) $entityElement['name'];
$result[$entityName] = $entityElement; $result[$entityName] = $entityElement;
} }
} else if (isset($xmlElement->{'mapped-superclass'})) { } else if (isset($xmlElement->{'mapped-superclass'})) {
foreach ($xmlElement->{'mapped-superclass'} as $mappedSuperClass) { foreach ($xmlElement->{'mapped-superclass'} as $mappedSuperClass) {
$className = (string)$mappedSuperClass['name']; $className = (string) $mappedSuperClass['name'];
$result[$className] = $mappedSuperClass; $result[$className] = $mappedSuperClass;
} }
} else if (isset($xmlElement->embeddable)) { } else if (isset($xmlElement->embeddable)) {
@ -846,7 +847,7 @@ class XmlDriver extends FileDriver
*/ */
protected function evaluateBoolean($element) protected function evaluateBoolean($element)
{ {
$flag = (string)$element; $flag = (string) $element;
return ($flag == "true" || $flag == "1"); return ($flag == "true" || $flag == "1");
} }

View File

@ -175,10 +175,10 @@ class YamlDriver extends FileDriver
if (isset($element['discriminatorColumn'])) { if (isset($element['discriminatorColumn'])) {
$discrColumn = $element['discriminatorColumn']; $discrColumn = $element['discriminatorColumn'];
$metadata->setDiscriminatorColumn(array( $metadata->setDiscriminatorColumn(array(
'name' => isset($discrColumn['name']) ? (string)$discrColumn['name'] : null, 'name' => isset($discrColumn['name']) ? (string) $discrColumn['name'] : null,
'type' => isset($discrColumn['type']) ? (string)$discrColumn['type'] : null, 'type' => isset($discrColumn['type']) ? (string) $discrColumn['type'] : null,
'length' => isset($discrColumn['length']) ? (string)$discrColumn['length'] : null, 'length' => isset($discrColumn['length']) ? (string) $discrColumn['length'] : null,
'columnDefinition' => isset($discrColumn['columnDefinition']) ? (string)$discrColumn['columnDefinition'] : null 'columnDefinition' => isset($discrColumn['columnDefinition']) ? (string) $discrColumn['columnDefinition'] : null
)); ));
} else { } else {
$metadata->setDiscriminatorColumn(array('name' => 'dtype', 'type' => 'string', 'length' => 255)); $metadata->setDiscriminatorColumn(array('name' => 'dtype', 'type' => 'string', 'length' => 255));
@ -385,7 +385,7 @@ class YamlDriver extends FileDriver
} }
if (isset($oneToOneElement['orphanRemoval'])) { if (isset($oneToOneElement['orphanRemoval'])) {
$mapping['orphanRemoval'] = (bool)$oneToOneElement['orphanRemoval']; $mapping['orphanRemoval'] = (bool) $oneToOneElement['orphanRemoval'];
} }
// Evaluate second level cache // Evaluate second level cache
@ -415,7 +415,7 @@ class YamlDriver extends FileDriver
} }
if (isset($oneToManyElement['orphanRemoval'])) { if (isset($oneToManyElement['orphanRemoval'])) {
$mapping['orphanRemoval'] = (bool)$oneToManyElement['orphanRemoval']; $mapping['orphanRemoval'] = (bool) $oneToManyElement['orphanRemoval'];
} }
if (isset($oneToManyElement['orderBy'])) { if (isset($oneToManyElement['orderBy'])) {
@ -548,7 +548,7 @@ class YamlDriver extends FileDriver
} }
if (isset($manyToManyElement['orphanRemoval'])) { if (isset($manyToManyElement['orphanRemoval'])) {
$mapping['orphanRemoval'] = (bool)$manyToManyElement['orphanRemoval']; $mapping['orphanRemoval'] = (bool) $manyToManyElement['orphanRemoval'];
} }
// Evaluate second level cache // Evaluate second level cache
@ -646,7 +646,7 @@ class YamlDriver extends FileDriver
continue; continue;
} }
foreach ($entityListener as $eventName => $callbackElement){ foreach ($entityListener as $eventName => $callbackElement) {
foreach ($callbackElement as $methodName) { foreach ($callbackElement as $methodName) {
$metadata->addEntityListener($eventName, $className, $methodName); $metadata->addEntityListener($eventName, $className, $methodName);
} }
@ -739,7 +739,7 @@ class YamlDriver extends FileDriver
} }
if (isset($column['unique'])) { if (isset($column['unique'])) {
$mapping['unique'] = (bool)$column['unique']; $mapping['unique'] = (bool) $column['unique'];
} }
if (isset($column['options'])) { if (isset($column['options'])) {

View File

@ -772,6 +772,7 @@ class MappingException extends \Doctrine\ORM\ORMException
public static function invalidCascadeOption(array $cascades, $className, $propertyName) public static function invalidCascadeOption(array $cascades, $className, $propertyName)
{ {
$cascades = implode(", ", array_map(function ($e) { return "'" . $e . "'"; }, $cascades)); $cascades = implode(", ", array_map(function ($e) { return "'" . $e . "'"; }, $cascades));
return new self(sprintf( return new self(sprintf(
"You have specified invalid cascade options for %s::$%s: %s; available options: 'remove', 'persist', 'refresh', 'merge', and 'detach'", "You have specified invalid cascade options for %s::$%s: %s; available options: 'remove', 'persist', 'refresh', 'merge', and 'detach'",
$className, $className,

View File

@ -95,10 +95,8 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
. " To solve this issue: Either explicitly call EntityManager#persist()" . " To solve this issue: Either explicitly call EntityManager#persist()"
. " on this unknown entity or configure cascade persist " . " on this unknown entity or configure cascade persist "
. " this association in the mapping for example @ManyToOne(..,cascade={\"persist\"})." . " this association in the mapping for example @ManyToOne(..,cascade={\"persist\"})."
. (method_exists($entry, '__toString') ? . (method_exists($entry, '__toString') ? "": " If you cannot find out which entity causes the problem"
"": . " implement '" . $assoc['targetEntity'] . "#__toString()' to get a clue."));
" If you cannot find out which entity causes the problem"
." implement '" . $assoc['targetEntity'] . "#__toString()' to get a clue."));
} }
/** /**
@ -221,6 +219,6 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
*/ */
private static function objToStr($obj) private static function objToStr($obj)
{ {
return method_exists($obj, '__toString') ? (string)$obj : get_class($obj).'@'.spl_object_hash($obj); return method_exists($obj, '__toString') ? (string) $obj : get_class($obj).'@'.spl_object_hash($obj);
} }
} }

View File

@ -75,6 +75,7 @@ class OptimisticLockException extends ORMException
{ {
$expectedLockVersion = ($expectedLockVersion instanceof \DateTime) ? $expectedLockVersion->getTimestamp() : $expectedLockVersion; $expectedLockVersion = ($expectedLockVersion instanceof \DateTime) ? $expectedLockVersion->getTimestamp() : $expectedLockVersion;
$actualLockVersion = ($actualLockVersion instanceof \DateTime) ? $actualLockVersion->getTimestamp() : $actualLockVersion; $actualLockVersion = ($actualLockVersion instanceof \DateTime) ? $actualLockVersion->getTimestamp() : $actualLockVersion;
return new self("The optimistic lock failed, version " . $expectedLockVersion . " was expected, but is actually ".$actualLockVersion, $entity); return new self("The optimistic lock failed, version " . $expectedLockVersion . " was expected, but is actually ".$actualLockVersion, $entity);
} }

View File

@ -2047,6 +2047,7 @@ class BasicEntityPersister implements EntityPersister
} }
$sql = implode(' AND ', $filterClauses); $sql = implode(' AND ', $filterClauses);
return $sql ? "(" . $sql . ")" : ""; // Wrap again to avoid "X or Y and FilterConditionSQL" return $sql ? "(" . $sql . ")" : ""; // Wrap again to avoid "X or Y and FilterConditionSQL"
} }

View File

@ -78,6 +78,7 @@ interface EntityPersister
* Get the COUNT SQL to count entities (optionally based on a criteria) * Get the COUNT SQL to count entities (optionally based on a criteria)
* *
* @param array|\Doctrine\Common\Collections\Criteria $criteria * @param array|\Doctrine\Common\Collections\Criteria $criteria
*
* @return string * @return string
*/ */
public function getCountSQL($criteria = array()); public function getCountSQL($criteria = array());

View File

@ -590,6 +590,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
/** /**
* @param string $baseTableAlias * @param string $baseTableAlias
*
* @return string * @return string
*/ */
private function getJoinSql($baseTableAlias) private function getJoinSql($baseTableAlias)

View File

@ -40,6 +40,7 @@ class BitAndFunction extends FunctionNode
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
$platform = $sqlWalker->getConnection()->getDatabasePlatform(); $platform = $sqlWalker->getConnection()->getDatabasePlatform();
return $platform->getBitAndComparisonExpression( return $platform->getBitAndComparisonExpression(
$this->firstArithmetic->dispatch($sqlWalker), $this->firstArithmetic->dispatch($sqlWalker),
$this->secondArithmetic->dispatch($sqlWalker) $this->secondArithmetic->dispatch($sqlWalker)

View File

@ -40,6 +40,7 @@ class BitOrFunction extends FunctionNode
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
$platform = $sqlWalker->getConnection()->getDatabasePlatform(); $platform = $sqlWalker->getConnection()->getDatabasePlatform();
return $platform->getBitOrComparisonExpression( return $platform->getBitOrComparisonExpression(
$this->firstArithmetic->dispatch($sqlWalker), $this->firstArithmetic->dispatch($sqlWalker),
$this->secondArithmetic->dispatch($sqlWalker) $this->secondArithmetic->dispatch($sqlWalker)

View File

@ -70,7 +70,7 @@ class IdentityFunction extends FunctionNode
foreach ($assoc['joinColumns'] as $mapping) { foreach ($assoc['joinColumns'] as $mapping) {
if($mapping['referencedColumnName'] === $field['columnName']) { if ($mapping['referencedColumnName'] === $field['columnName']) {
$joinColumn = $mapping; $joinColumn = $mapping;
break; break;

View File

@ -105,8 +105,6 @@ class TrimFunction extends FunctionNode
} }
/** /**
* @param \Doctrine\ORM\Query\Parser $parser
*
* @return integer * @return integer
*/ */
private function getTrimMode() private function getTrimMode()

View File

@ -449,6 +449,7 @@ class Expr
} }
} }
} }
return new Expr\Func($x . ' IN', (array) $y); return new Expr\Func($x . ' IN', (array) $y);
} }
@ -469,6 +470,7 @@ class Expr
} }
} }
} }
return new Expr\Func($x . ' NOT IN', (array) $y); return new Expr\Func($x . ' NOT IN', (array) $y);
} }
@ -550,6 +552,7 @@ class Expr
if (null !== $len) { if (null !== $len) {
$args[] = $len; $args[] = $len;
} }
return new Expr\Func('SUBSTRING', $args); return new Expr\Func('SUBSTRING', $args);
} }

View File

@ -125,7 +125,7 @@ class Lexer extends \Doctrine\Common\Lexer
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function getCatchablePatterns() protected function getCatchablePatterns()
{ {
@ -139,7 +139,7 @@ class Lexer extends \Doctrine\Common\Lexer
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function getNonCatchablePatterns() protected function getNonCatchablePatterns()
{ {
@ -147,7 +147,7 @@ class Lexer extends \Doctrine\Common\Lexer
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function getType(&$value) protected function getType(&$value)
{ {

View File

@ -637,7 +637,7 @@ class Parser
// If the namespace is not given then assumes the first FROM entity namespace // If the namespace is not given then assumes the first FROM entity namespace
if (strpos($className, '\\') === false && ! class_exists($className) && strpos($fromClassName, '\\') !== false) { if (strpos($className, '\\') === false && ! class_exists($className) && strpos($fromClassName, '\\') !== false) {
$namespace = substr($fromClassName, 0 , strrpos($fromClassName, '\\')); $namespace = substr($fromClassName, 0, strrpos($fromClassName, '\\'));
$fqcn = $namespace . '\\' . $className; $fqcn = $namespace . '\\' . $className;
if (class_exists($fqcn)) { if (class_exists($fqcn)) {
@ -1611,7 +1611,6 @@ class Parser
} }
/** /**
*
* SubselectIdentificationVariableDeclaration ::= IdentificationVariableDeclaration * SubselectIdentificationVariableDeclaration ::= IdentificationVariableDeclaration
* *
* {Internal note: WARNING: Solution is harder than a bare implementation. * {Internal note: WARNING: Solution is harder than a bare implementation.
@ -1963,7 +1962,6 @@ class Parser
case $this->isMathOperator($peek): case $this->isMathOperator($peek):
// :param + u.value // :param + u.value
return $this->SimpleArithmeticExpression(); return $this->SimpleArithmeticExpression();
default: default:
return $this->InputParameter(); return $this->InputParameter();
} }
@ -2669,22 +2667,22 @@ class Parser
switch ($this->lexer->lookahead['type']) { switch ($this->lexer->lookahead['type']) {
case Lexer::T_STRING: case Lexer::T_STRING:
$this->match(Lexer::T_STRING); $this->match(Lexer::T_STRING);
return new AST\Literal(AST\Literal::STRING, $this->lexer->token['value']);
return new AST\Literal(AST\Literal::STRING, $this->lexer->token['value']);
case Lexer::T_INTEGER: case Lexer::T_INTEGER:
case Lexer::T_FLOAT: case Lexer::T_FLOAT:
$this->match( $this->match(
$this->lexer->isNextToken(Lexer::T_INTEGER) ? Lexer::T_INTEGER : Lexer::T_FLOAT $this->lexer->isNextToken(Lexer::T_INTEGER) ? Lexer::T_INTEGER : Lexer::T_FLOAT
); );
return new AST\Literal(AST\Literal::NUMERIC, $this->lexer->token['value']);
return new AST\Literal(AST\Literal::NUMERIC, $this->lexer->token['value']);
case Lexer::T_TRUE: case Lexer::T_TRUE:
case Lexer::T_FALSE: case Lexer::T_FALSE:
$this->match( $this->match(
$this->lexer->isNextToken(Lexer::T_TRUE) ? Lexer::T_TRUE : Lexer::T_FALSE $this->lexer->isNextToken(Lexer::T_TRUE) ? Lexer::T_TRUE : Lexer::T_FALSE
); );
return new AST\Literal(AST\Literal::BOOLEAN, $this->lexer->token['value']);
return new AST\Literal(AST\Literal::BOOLEAN, $this->lexer->token['value']);
default: default:
$this->syntaxError('Literal'); $this->syntaxError('Literal');
} }

View File

@ -147,8 +147,8 @@ class QueryExpressionVisitor extends ExpressionVisitor
$parameterName = str_replace('.', '_', $comparison->getField()); $parameterName = str_replace('.', '_', $comparison->getField());
foreach($this->parameters as $parameter) { foreach ($this->parameters as $parameter) {
if($parameter->getName() === $parameterName) { if ($parameter->getName() === $parameterName) {
$parameterName .= '_' . count($this->parameters); $parameterName .= '_' . count($this->parameters);
break; break;
} }
@ -160,36 +160,37 @@ class QueryExpressionVisitor extends ExpressionVisitor
switch ($comparison->getOperator()) { switch ($comparison->getOperator()) {
case Comparison::IN: case Comparison::IN:
$this->parameters[] = $parameter; $this->parameters[] = $parameter;
return $this->expr->in($field, $placeholder);
return $this->expr->in($field, $placeholder);
case Comparison::NIN: case Comparison::NIN:
$this->parameters[] = $parameter; $this->parameters[] = $parameter;
return $this->expr->notIn($field, $placeholder);
return $this->expr->notIn($field, $placeholder);
case Comparison::EQ: case Comparison::EQ:
case Comparison::IS: case Comparison::IS:
if ($this->walkValue($comparison->getValue()) === null) { if ($this->walkValue($comparison->getValue()) === null) {
return $this->expr->isNull($field); return $this->expr->isNull($field);
} }
$this->parameters[] = $parameter; $this->parameters[] = $parameter;
return $this->expr->eq($field, $placeholder);
return $this->expr->eq($field, $placeholder);
case Comparison::NEQ: case Comparison::NEQ:
if ($this->walkValue($comparison->getValue()) === null) { if ($this->walkValue($comparison->getValue()) === null) {
return $this->expr->isNotNull($field); return $this->expr->isNotNull($field);
} }
$this->parameters[] = $parameter; $this->parameters[] = $parameter;
return $this->expr->neq($field, $placeholder);
return $this->expr->neq($field, $placeholder);
case Comparison::CONTAINS: case Comparison::CONTAINS:
$parameter->setValue('%' . $parameter->getValue() . '%', $parameter->getType()); $parameter->setValue('%' . $parameter->getValue() . '%', $parameter->getType());
$this->parameters[] = $parameter; $this->parameters[] = $parameter;
return $this->expr->like($field, $placeholder);
return $this->expr->like($field, $placeholder);
default: default:
$operator = self::convertComparisonOperator($comparison->getOperator()); $operator = self::convertComparisonOperator($comparison->getOperator());
if ($operator) { if ($operator) {
$this->parameters[] = $parameter; $this->parameters[] = $parameter;
return new Expr\Comparison( return new Expr\Comparison(
$field, $field,
$operator, $operator,

View File

@ -408,7 +408,7 @@ class ResultSetMappingBuilder extends ResultSetMapping
$this->addFieldResult($alias, $field['column'], $fieldName, $classMetadata->name); $this->addFieldResult($alias, $field['column'], $fieldName, $classMetadata->name);
} }
} else { } else {
if( ! isset($classMetadata->fieldMappings[$fieldName])) { if ( ! isset($classMetadata->fieldMappings[$fieldName])) {
throw new \InvalidArgumentException("Entity '".$classMetadata->name."' has no field '".$fieldName."'. "); throw new \InvalidArgumentException("Entity '".$classMetadata->name."' has no field '".$fieldName."'. ");
} }

View File

@ -917,7 +917,7 @@ class SqlWalker implements TreeWalker
$relation = $this->queryComponents[$joinedDqlAlias]['relation']; $relation = $this->queryComponents[$joinedDqlAlias]['relation'];
$targetClass = $this->em->getClassMetadata($relation['targetEntity']); $targetClass = $this->em->getClassMetadata($relation['targetEntity']);
$sourceClass = $this->em->getClassMetadata($relation['sourceEntity']); $sourceClass = $this->em->getClassMetadata($relation['sourceEntity']);
$targetTableName = $this->quoteStrategy->getTableName($targetClass,$this->platform); $targetTableName = $this->quoteStrategy->getTableName($targetClass, $this->platform);
$targetTableAlias = $this->getSQLTableAlias($targetClass->getTableName(), $joinedDqlAlias); $targetTableAlias = $this->getSQLTableAlias($targetClass->getTableName(), $joinedDqlAlias);
$sourceTableAlias = $this->getSQLTableAlias($sourceClass->getTableName(), $associationPathExpression->identificationVariable); $sourceTableAlias = $this->getSQLTableAlias($sourceClass->getTableName(), $associationPathExpression->identificationVariable);

View File

@ -336,7 +336,7 @@ abstract class TreeWalkerAdapter implements TreeWalker
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function walkInstanceOfExpression($instanceOfExpr) public function walkInstanceOfExpression($instanceOfExpr)
{ {
} }

View File

@ -429,7 +429,7 @@ class TreeWalkerChain implements TreeWalker
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function walkInstanceOfExpression($instanceOfExpr) public function walkInstanceOfExpression($instanceOfExpr)
{ {
foreach ($this->_walkers as $walker) { foreach ($this->_walkers as $walker) {
$walker->walkInstanceOfExpression($instanceOfExpr); $walker->walkInstanceOfExpression($instanceOfExpr);

View File

@ -51,7 +51,7 @@ class TreeWalkerChainIterator implements \Iterator, \ArrayAccess
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function rewind() public function rewind()
{ {
return reset($this->walkers); return reset($this->walkers);
} }
@ -59,7 +59,7 @@ class TreeWalkerChainIterator implements \Iterator, \ArrayAccess
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function current() public function current()
{ {
return $this->offsetGet(key($this->walkers)); return $this->offsetGet(key($this->walkers));
} }
@ -67,7 +67,7 @@ class TreeWalkerChainIterator implements \Iterator, \ArrayAccess
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function key() public function key()
{ {
return key($this->walkers); return key($this->walkers);
} }
@ -75,7 +75,7 @@ class TreeWalkerChainIterator implements \Iterator, \ArrayAccess
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function next() public function next()
{ {
next($this->walkers); next($this->walkers);
@ -85,7 +85,7 @@ class TreeWalkerChainIterator implements \Iterator, \ArrayAccess
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function valid() public function valid()
{ {
return key($this->walkers) !== null; return key($this->walkers) !== null;
} }

View File

@ -41,7 +41,7 @@ class AttachEntityListenersListener
* @param string $entityClass The entity to attach the listener. * @param string $entityClass The entity to attach the listener.
* @param string $listenerClass The listener class. * @param string $listenerClass The listener class.
* @param string $eventName The entity lifecycle event. * @param string $eventName The entity lifecycle event.
* @param string $listenerCallback|null The listener callback method or NULL to use $eventName. * @param string|null $listenerCallback The listener callback method or NULL to use $eventName.
* *
* @return void * @return void
*/ */

View File

@ -47,7 +47,7 @@ class CollectionRegionCommand extends Command
->addArgument('association', InputArgument::OPTIONAL, 'The association collection name.') ->addArgument('association', InputArgument::OPTIONAL, 'The association collection name.')
->addArgument('owner-id', InputArgument::OPTIONAL, 'The owner identifier.') ->addArgument('owner-id', InputArgument::OPTIONAL, 'The owner identifier.')
->addOption('all', null, InputOption::VALUE_NONE, 'If defined, all entity regions will be deleted/invalidated.') ->addOption('all', null, InputOption::VALUE_NONE, 'If defined, all entity regions will be deleted/invalidated.')
->addOption('flush', null, InputOption::VALUE_NONE,'If defined, all cache entries will be flushed.'); ->addOption('flush', null, InputOption::VALUE_NONE, 'If defined, all cache entries will be flushed.');
$this->setHelp(<<<EOT $this->setHelp(<<<EOT

View File

@ -46,7 +46,7 @@ class EntityRegionCommand extends Command
->addArgument('entity-class', InputArgument::OPTIONAL, 'The entity name.') ->addArgument('entity-class', InputArgument::OPTIONAL, 'The entity name.')
->addArgument('entity-id', InputArgument::OPTIONAL, 'The entity identifier.') ->addArgument('entity-id', InputArgument::OPTIONAL, 'The entity identifier.')
->addOption('all', null, InputOption::VALUE_NONE, 'If defined, all entity regions will be deleted/invalidated.') ->addOption('all', null, InputOption::VALUE_NONE, 'If defined, all entity regions will be deleted/invalidated.')
->addOption('flush', null, InputOption::VALUE_NONE,'If defined, all cache entries will be flushed.'); ->addOption('flush', null, InputOption::VALUE_NONE, 'If defined, all cache entries will be flushed.');
$this->setHelp(<<<EOT $this->setHelp(<<<EOT

View File

@ -45,7 +45,7 @@ class QueryRegionCommand extends Command
->setDescription('Clear a second-level cache query region.') ->setDescription('Clear a second-level cache query region.')
->addArgument('region-name', InputArgument::OPTIONAL, 'The query region to clear.') ->addArgument('region-name', InputArgument::OPTIONAL, 'The query region to clear.')
->addOption('all', null, InputOption::VALUE_NONE, 'If defined, all query regions will be deleted/invalidated.') ->addOption('all', null, InputOption::VALUE_NONE, 'If defined, all query regions will be deleted/invalidated.')
->addOption('flush', null, InputOption::VALUE_NONE,'If defined, all cache entries will be flushed.'); ->addOption('flush', null, InputOption::VALUE_NONE, 'If defined, all cache entries will be flushed.');
$this->setHelp(<<<EOT $this->setHelp(<<<EOT

View File

@ -110,12 +110,12 @@ EOT
if ($numRepositories) { if ($numRepositories) {
// Outputting information message // Outputting information message
$output->writeln(PHP_EOL . sprintf('Repository classes generated to "<info>%s</INFO>"', $destPath) ); $output->writeln(PHP_EOL . sprintf('Repository classes generated to "<info>%s</INFO>"', $destPath));
} else { } else {
$output->writeln('No Repository classes were found to be processed.' ); $output->writeln('No Repository classes were found to be processed.');
} }
} else { } else {
$output->writeln('No Metadata Classes to process.' ); $output->writeln('No Metadata Classes to process.');
} }
} }
} }

View File

@ -257,7 +257,7 @@ EOT
/** /**
* Format the association mappings * Format the association mappings
* *
* @param array * @param array $propertyMappings
* *
* @return array * @return array
*/ */

View File

@ -65,6 +65,7 @@ abstract class AbstractCommand extends Command
return $this->executeSchemaCommand($input, $output, $tool, $metadatas); return $this->executeSchemaCommand($input, $output, $tool, $metadatas);
} else { } else {
$output->writeln('No Metadata Classes to process.'); $output->writeln('No Metadata Classes to process.');
return 0; return 0;
} }
} }

View File

@ -81,6 +81,7 @@ class DebugUnitOfWorkListener
$fh = fopen($this->file, "x+"); $fh = fopen($this->file, "x+");
if (count($identityMap) == 0) { if (count($identityMap) == 0) {
fwrite($fh, "Flush Operation [".$this->context."] - Empty identity map.\n"); fwrite($fh, "Flush Operation [".$this->context."] - Empty identity map.\n");
return; return;
} }

View File

@ -1100,6 +1100,7 @@ public function __construct(<params>)
} }
$annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})'; $annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})';
} }
return implode(', ', $annotations); return implode(', ', $annotations);
} }
@ -1241,7 +1242,7 @@ public function __construct(<params>)
} }
foreach ($joinColumns as $joinColumn) { foreach ($joinColumns as $joinColumn) {
if(isset($joinColumn['nullable']) && !$joinColumn['nullable']) { if (isset($joinColumn['nullable']) && !$joinColumn['nullable']) {
return false; return false;
} }
} }
@ -1811,12 +1812,14 @@ public function __construct(<params>)
* Exports (nested) option elements. * Exports (nested) option elements.
* *
* @param array $options * @param array $options
*
* @return string
*/ */
private function exportTableOptions(array $options) private function exportTableOptions(array $options)
{ {
$optionsStr = array(); $optionsStr = array();
foreach($options as $name => $option) { foreach ($options as $name => $option) {
if (is_array($option)) { if (is_array($option)) {
$optionsStr[] = '"' . $name . '"={' . $this->exportTableOptions($option) . '}'; $optionsStr[] = '"' . $name . '"={' . $this->exportTableOptions($option) . '}';
} else { } else {

View File

@ -135,7 +135,7 @@ abstract class AbstractExporter
foreach ($this->_metadata as $metadata) { foreach ($this->_metadata as $metadata) {
// In case output is returned, write it to a file, skip otherwise // In case output is returned, write it to a file, skip otherwise
if($output = $this->exportClassMetadata($metadata)){ if ($output = $this->exportClassMetadata($metadata)) {
$path = $this->_generateOutputPath($metadata); $path = $this->_generateOutputPath($metadata);
$dir = dirname($path); $dir = dirname($path);
if ( ! is_dir($dir)) { if ( ! is_dir($dir)) {

View File

@ -108,7 +108,7 @@ class XmlExporter extends AbstractExporter
$indexXml = $indexesXml->addChild('index'); $indexXml = $indexesXml->addChild('index');
$indexXml->addAttribute('name', $name); $indexXml->addAttribute('name', $name);
$indexXml->addAttribute('columns', implode(',', $index['columns'])); $indexXml->addAttribute('columns', implode(',', $index['columns']));
if(isset($index['flags'])) { if (isset($index['flags'])) {
$indexXml->addAttribute('flags', implode(',', $index['flags'])); $indexXml->addAttribute('flags', implode(',', $index['flags']));
} }
} }

View File

@ -110,6 +110,7 @@ class Paginator implements \Countable, \IteratorAggregate
public function setUseOutputWalkers($useOutputWalkers) public function setUseOutputWalkers($useOutputWalkers)
{ {
$this->useOutputWalkers = $useOutputWalkers; $this->useOutputWalkers = $useOutputWalkers;
return $this; return $this;
} }
@ -121,7 +122,7 @@ class Paginator implements \Countable, \IteratorAggregate
if ($this->count === null) { if ($this->count === null) {
try { try {
$this->count = array_sum(array_map('current', $this->getCountQuery()->getScalarResult())); $this->count = array_sum(array_map('current', $this->getCountQuery()->getScalarResult()));
} catch(NoResultException $e) { } catch (NoResultException $e) {
$this->count = 0; $this->count = 0;
} }
} }
@ -267,7 +268,7 @@ class Paginator implements \Countable, \IteratorAggregate
foreach ($parameters as $key => $parameter) { foreach ($parameters as $key => $parameter) {
$parameterName = $parameter->getName(); $parameterName = $parameter->getName();
if( ! (isset($parameterMappings[$parameterName]) || array_key_exists($parameterName, $parameterMappings))) { if ( ! (isset($parameterMappings[$parameterName]) || array_key_exists($parameterName, $parameterMappings))) {
unset($parameters[$key]); unset($parameters[$key]);
} }
} }

View File

@ -109,6 +109,7 @@ class SchemaTool
public function getCreateSchemaSql(array $classes) public function getCreateSchemaSql(array $classes)
{ {
$schema = $this->getSchemaFromMetadata($classes); $schema = $this->getSchemaFromMetadata($classes);
return $schema->toSql($this->platform); return $schema->toSql($this->platform);
} }
@ -278,11 +279,11 @@ class SchemaTool
if (isset($class->table['indexes'])) { if (isset($class->table['indexes'])) {
foreach ($class->table['indexes'] as $indexName => $indexData) { foreach ($class->table['indexes'] as $indexName => $indexData) {
if( ! isset($indexData['flags'])) { if ( ! isset($indexData['flags'])) {
$indexData['flags'] = array(); $indexData['flags'] = array();
} }
$table->addIndex($indexData['columns'], is_numeric($indexName) ? null : $indexName, (array)$indexData['flags'], isset($indexData['options']) ? $indexData['options'] : array()); $table->addIndex($indexData['columns'], is_numeric($indexName) ? null : $indexName, (array) $indexData['flags'], isset($indexData['options']) ? $indexData['options'] : array());
} }
} }
@ -622,7 +623,8 @@ class SchemaTool
&$primaryKeyColumns, &$primaryKeyColumns,
&$addedFks, &$addedFks,
&$blacklistedFks &$blacklistedFks
) { )
{
$localColumns = array(); $localColumns = array();
$foreignColumns = array(); $foreignColumns = array();
$fkOptions = array(); $fkOptions = array();

View File

@ -97,6 +97,7 @@ class SchemaValidator
foreach ($class->associationMappings as $fieldName => $assoc) { foreach ($class->associationMappings as $fieldName => $assoc) {
if (!class_exists($assoc['targetEntity']) || $cmf->isTransient($assoc['targetEntity'])) { if (!class_exists($assoc['targetEntity']) || $cmf->isTransient($assoc['targetEntity'])) {
$ce[] = "The target entity '" . $assoc['targetEntity'] . "' specified on " . $class->name . '#' . $fieldName . ' is unknown or not an entity.'; $ce[] = "The target entity '" . $assoc['targetEntity'] . "' specified on " . $class->name . '#' . $fieldName . ' is unknown or not an entity.';
return $ce; return $ce;
} }
@ -154,13 +155,13 @@ class SchemaValidator
// Verify inverse side/owning side match each other // Verify inverse side/owning side match each other
if (array_key_exists($assoc['inversedBy'], $targetMetadata->associationMappings)) { if (array_key_exists($assoc['inversedBy'], $targetMetadata->associationMappings)) {
$targetAssoc = $targetMetadata->associationMappings[$assoc['inversedBy']]; $targetAssoc = $targetMetadata->associationMappings[$assoc['inversedBy']];
if ($assoc['type'] == ClassMetadataInfo::ONE_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_ONE){ if ($assoc['type'] == ClassMetadataInfo::ONE_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_ONE) {
$ce[] = "If association " . $class->name . "#" . $fieldName . " is one-to-one, then the inversed " . $ce[] = "If association " . $class->name . "#" . $fieldName . " is one-to-one, then the inversed " .
"side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be one-to-one as well."; "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be one-to-one as well.";
} elseif ($assoc['type'] == ClassMetadataInfo::MANY_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_MANY){ } elseif ($assoc['type'] == ClassMetadataInfo::MANY_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_MANY) {
$ce[] = "If association " . $class->name . "#" . $fieldName . " is many-to-one, then the inversed " . $ce[] = "If association " . $class->name . "#" . $fieldName . " is many-to-one, then the inversed " .
"side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be one-to-many."; "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be one-to-many.";
} elseif ($assoc['type'] == ClassMetadataInfo::MANY_TO_MANY && $targetAssoc['type'] !== ClassMetadataInfo::MANY_TO_MANY){ } elseif ($assoc['type'] == ClassMetadataInfo::MANY_TO_MANY && $targetAssoc['type'] !== ClassMetadataInfo::MANY_TO_MANY) {
$ce[] = "If association " . $class->name . "#" . $fieldName . " is many-to-many, then the inversed " . $ce[] = "If association " . $class->name . "#" . $fieldName . " is many-to-many, then the inversed " .
"side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be many-to-many as well."; "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be many-to-many as well.";
} }

View File

@ -3224,7 +3224,7 @@ class UnitOfWork implements PropertyChangedListener
*/ */
private static function objToStr($obj) private static function objToStr($obj)
{ {
return method_exists($obj, '__toString') ? (string)$obj : get_class($obj).'@'.spl_object_hash($obj); return method_exists($obj, '__toString') ? (string) $obj : get_class($obj).'@'.spl_object_hash($obj);
} }
/** /**