Merge branch 'dead_code_cleanup'
This commit is contained in:
commit
08b455b029
@ -406,7 +406,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
|
||||
*/
|
||||
private function addInheritedFields(ClassMetadata $subClass, ClassMetadata $parentClass)
|
||||
{
|
||||
foreach ($parentClass->fieldMappings as $fieldName => $mapping) {
|
||||
foreach ($parentClass->fieldMappings as $mapping) {
|
||||
if ( ! isset($mapping['inherited']) && ! $parentClass->isMappedSuperclass) {
|
||||
$mapping['inherited'] = $parentClass->name;
|
||||
}
|
||||
|
@ -838,7 +838,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
*/
|
||||
public function validateAssocations()
|
||||
{
|
||||
foreach ($this->associationMappings as $field => $mapping) {
|
||||
foreach ($this->associationMappings as $mapping) {
|
||||
if ( ! \Doctrine\Common\ClassLoader::classExists($mapping['targetEntity']) ) {
|
||||
throw MappingException::invalidTargetEntityClass($mapping['targetEntity'], $this->name, $mapping['fieldName']);
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ class AnnotationDriver implements Driver
|
||||
$metadata->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_' . $generatedValueAnnot->strategy));
|
||||
}
|
||||
|
||||
if ($versionAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Version')) {
|
||||
if ($this->_reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Version')) {
|
||||
$metadata->setVersionMapping($mapping);
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ class AnnotationDriver implements Driver
|
||||
'allocationSize' => $seqGeneratorAnnot->allocationSize,
|
||||
'initialValue' => $seqGeneratorAnnot->initialValue
|
||||
));
|
||||
} else if ($tblGeneratorAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\TableGenerator')) {
|
||||
} else if ($this->_reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\TableGenerator')) {
|
||||
throw MappingException::tableIdGeneratorNotImplemented($className);
|
||||
} else if ($customGeneratorAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\CustomIdGenerator')) {
|
||||
$metadata->setCustomGeneratorDefinition(array(
|
||||
|
@ -103,7 +103,7 @@ class StaticPHPDriver implements Driver
|
||||
);
|
||||
|
||||
foreach ($iterator as $file) {
|
||||
if (($fileName = $file->getBasename($this->_fileExtension)) == $file->getBasename()) {
|
||||
if ($file->getBasename($this->_fileExtension) == $file->getBasename()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -498,7 +498,6 @@ class BasicEntityPersister
|
||||
continue;
|
||||
}
|
||||
|
||||
$oldVal = $change[0];
|
||||
$newVal = $change[1];
|
||||
|
||||
if (isset($this->_class->associationMappings[$field])) {
|
||||
@ -711,7 +710,6 @@ class BasicEntityPersister
|
||||
*/
|
||||
public function loadAll(array $criteria = array(), array $orderBy = null, $limit = null, $offset = null)
|
||||
{
|
||||
$entities = array();
|
||||
$sql = $this->_getSelectEntitiesSQL($criteria, null, 0, $limit, $offset, $orderBy);
|
||||
list($params, $types) = $this->expandParameters($criteria);
|
||||
$stmt = $this->_conn->executeQuery($sql, $params, $types);
|
||||
@ -995,7 +993,7 @@ class BasicEntityPersister
|
||||
$assocAlias = 'e' . ($eagerAliasCounter++);
|
||||
$this->_rsm->addJoinedEntityResult($assoc['targetEntity'], $assocAlias, 'r', $assocField);
|
||||
|
||||
foreach ($eagerEntity->fieldNames AS $field) {
|
||||
foreach ($eagerEntity->fieldNames as $field) {
|
||||
if ($columnList) $columnList .= ', ';
|
||||
|
||||
$columnList .= $this->_getSelectColumnSQL($field, $eagerEntity, $assocAlias);
|
||||
@ -1016,7 +1014,7 @@ class BasicEntityPersister
|
||||
$this->_selectJoinSql .= ' ' . $eagerEntity->getQuotedTableName($this->_platform) . ' ' . $this->_getSQLTableAlias($eagerEntity->name, $assocAlias) .' ON ';
|
||||
|
||||
$tableAlias = $this->_getSQLTableAlias($assoc['targetEntity'], $assocAlias);
|
||||
foreach ($assoc['sourceToTargetKeyColumns'] AS $sourceCol => $targetCol) {
|
||||
foreach ($assoc['sourceToTargetKeyColumns'] as $sourceCol => $targetCol) {
|
||||
if ( ! $first) {
|
||||
$this->_selectJoinSql .= ' AND ';
|
||||
}
|
||||
@ -1037,7 +1035,7 @@ class BasicEntityPersister
|
||||
$this->_selectJoinSql .= ' ' . $eagerEntity->getQuotedTableName($this->_platform) . ' '
|
||||
. $this->_getSQLTableAlias($eagerEntity->name, $assocAlias) . ' ON ';
|
||||
|
||||
foreach ($owningAssoc['sourceToTargetKeyColumns'] AS $sourceCol => $targetCol) {
|
||||
foreach ($owningAssoc['sourceToTargetKeyColumns'] as $sourceCol => $targetCol) {
|
||||
if ( ! $first) {
|
||||
$this->_selectJoinSql .= ' AND ';
|
||||
}
|
||||
@ -1139,7 +1137,7 @@ class BasicEntityPersister
|
||||
$columns = array_unique($columns);
|
||||
|
||||
$values = array();
|
||||
foreach ($columns AS $column) {
|
||||
foreach ($columns as $column) {
|
||||
$placeholder = '?';
|
||||
|
||||
if (isset($this->_class->fieldNames[$column]) &&
|
||||
@ -1267,7 +1265,7 @@ class BasicEntityPersister
|
||||
|
||||
list($params, $types) = $this->expandParameters($criteria);
|
||||
|
||||
$stmt = $this->_conn->executeQuery($sql, $params, $types);
|
||||
$this->_conn->executeQuery($sql, $params, $types);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1418,7 +1416,7 @@ class BasicEntityPersister
|
||||
{
|
||||
$params = $types = array();
|
||||
|
||||
foreach ($criteria AS $field => $value) {
|
||||
foreach ($criteria as $field => $value) {
|
||||
if ($value === null) {
|
||||
continue; // skip null values.
|
||||
}
|
||||
@ -1539,7 +1537,7 @@ class BasicEntityPersister
|
||||
$sql .= ' AND ' . $filterSql;
|
||||
}
|
||||
|
||||
list($params, $types) = $this->expandParameters($criteria);
|
||||
list($params) = $this->expandParameters($criteria);
|
||||
|
||||
return (bool) $this->_conn->fetchColumn($sql, $params);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
// Composite identifier
|
||||
$sourceClass = $this->_em->getClassMetadata(get_class($mapping->getOwner()));
|
||||
|
||||
foreach ($mapping['relationToSourceKeyColumns'] as $relColumn => $srcColumn) {
|
||||
foreach ($mapping['relationToSourceKeyColumns'] as $srcColumn) {
|
||||
$params[] = $identifier[$sourceClass->fieldNames[$srcColumn]];
|
||||
}
|
||||
|
||||
|
@ -397,7 +397,7 @@ class <proxyClassName> extends \<className> implements \Doctrine\ORM\Proxy\Proxy
|
||||
if ($original === null) {
|
||||
throw new \Doctrine\ORM\EntityNotFoundException();
|
||||
}
|
||||
foreach ($class->reflFields AS $field => $reflProperty) {
|
||||
foreach ($class->reflFields as $field => $reflProperty) {
|
||||
$reflProperty->setValue($this, $reflProperty->getValue($original));
|
||||
}
|
||||
unset($this->_entityPersister, $this->_identifier);
|
||||
|
@ -39,7 +39,6 @@ class IdentityFunction extends FunctionNode
|
||||
*/
|
||||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
||||
{
|
||||
$platform = $sqlWalker->getConnection()->getDatabasePlatform();
|
||||
$dqlAlias = $this->pathExpression->identificationVariable;
|
||||
$assocField = $this->pathExpression->field;
|
||||
|
||||
|
@ -109,8 +109,6 @@ class SizeFunction extends FunctionNode
|
||||
*/
|
||||
public function parse(\Doctrine\ORM\Query\Parser $parser)
|
||||
{
|
||||
$lexer = $parser->getLexer();
|
||||
|
||||
$parser->match(Lexer::T_SIZE);
|
||||
$parser->match(Lexer::T_OPEN_PARENTHESIS);
|
||||
|
||||
|
@ -413,26 +413,6 @@ class Parser
|
||||
throw QueryException::semanticalError($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Peeks beyond the specified token and returns the first token after that one.
|
||||
*
|
||||
* @param array $token
|
||||
* @return array
|
||||
*/
|
||||
private function _peekBeyond($token)
|
||||
{
|
||||
$peek = $this->_lexer->peek();
|
||||
|
||||
while ($peek['value'] != $token) {
|
||||
$peek = $this->_lexer->peek();
|
||||
}
|
||||
|
||||
$peek = $this->_lexer->peek();
|
||||
$this->_lexer->resetPeek();
|
||||
|
||||
return $peek;
|
||||
}
|
||||
|
||||
/**
|
||||
* Peek beyond the matched closing parenthesis and return the first token after that one.
|
||||
*
|
||||
@ -601,7 +581,7 @@ class Parser
|
||||
// Check if queryComponent points to an AbstractSchemaName or a ResultVariable
|
||||
if ( ! isset($qComp['resultVariable'])) {
|
||||
$this->semanticalError(
|
||||
"'$identVariable' does not point to a ResultVariable.", $deferredItem['token']
|
||||
"'$resultVariable' does not point to a ResultVariable.", $deferredItem['token']
|
||||
);
|
||||
}
|
||||
|
||||
@ -652,8 +632,8 @@ class Parser
|
||||
$assoc = $class->associationMappings[$field];
|
||||
|
||||
$fieldType = ($assoc['type'] & ClassMetadata::TO_ONE)
|
||||
? AST\PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION
|
||||
: AST\PathExpression::TYPE_COLLECTION_VALUED_ASSOCIATION;
|
||||
? AST\PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION
|
||||
: AST\PathExpression::TYPE_COLLECTION_VALUED_ASSOCIATION;
|
||||
}
|
||||
|
||||
// Validate if PathExpression is one of the expected types
|
||||
@ -700,7 +680,7 @@ class Parser
|
||||
|
||||
$foundRootEntity = false;
|
||||
|
||||
foreach ($this->_identVariableExpressions AS $dqlAlias => $expr) {
|
||||
foreach ($this->_identVariableExpressions as $dqlAlias => $expr) {
|
||||
if (isset($this->_queryComponents[$dqlAlias]) && $this->_queryComponents[$dqlAlias]['parent'] === null) {
|
||||
$foundRootEntity = true;
|
||||
}
|
||||
@ -905,7 +885,6 @@ class Parser
|
||||
*/
|
||||
public function JoinAssociationPathExpression()
|
||||
{
|
||||
$token = $this->_lexer->lookahead;
|
||||
$identVariable = $this->IdentificationVariable();
|
||||
|
||||
if ( ! isset($this->_queryComponents[$identVariable])) {
|
||||
@ -941,7 +920,6 @@ class Parser
|
||||
*/
|
||||
public function PathExpression($expectedTypes)
|
||||
{
|
||||
$token = $this->_lexer->lookahead;
|
||||
$identVariable = $this->IdentificationVariable();
|
||||
$field = null;
|
||||
|
||||
@ -1451,7 +1429,7 @@ class Parser
|
||||
*/
|
||||
public function SubselectIdentificationVariableDeclaration()
|
||||
{
|
||||
$glimpse = $this->_lexer->glimpse();
|
||||
$this->_lexer->glimpse();
|
||||
|
||||
/* NOT YET IMPLEMENTED!
|
||||
|
||||
@ -2743,7 +2721,7 @@ class Parser
|
||||
*/
|
||||
public function ComparisonExpression()
|
||||
{
|
||||
$peek = $this->_lexer->glimpse();
|
||||
$this->_lexer->glimpse();
|
||||
|
||||
$leftExpr = $this->ArithmeticExpression();
|
||||
$operator = $this->ComparisonOperator();
|
||||
|
@ -68,7 +68,7 @@ EOT
|
||||
|
||||
foreach ($entityClassNames as $entityClassName) {
|
||||
try {
|
||||
$cm = $entityManager->getClassMetadata($entityClassName);
|
||||
$entityManager->getClassMetadata($entityClassName);
|
||||
$output->writeln(sprintf("<info>[OK]</info> %s", $entityClassName));
|
||||
} catch (MappingException $e) {
|
||||
$output->writeln("<error>[FAIL]</error> ".$entityClassName);
|
||||
|
@ -70,14 +70,14 @@ class DebugUnitOfWorkListener
|
||||
}
|
||||
|
||||
fwrite($fh, "Flush Operation [".$this->context."] - Dumping identity map:\n");
|
||||
foreach ($identityMap AS $className => $map) {
|
||||
foreach ($identityMap as $className => $map) {
|
||||
fwrite($fh, "Class: ". $className . "\n");
|
||||
foreach ($map AS $idHash => $entity) {
|
||||
foreach ($map as $entity) {
|
||||
fwrite($fh, " Entity: " . $this->getIdString($entity, $uow) . " " . spl_object_hash($entity)."\n");
|
||||
fwrite($fh, " Associations:\n");
|
||||
|
||||
$cm = $em->getClassMetadata($className);
|
||||
foreach ($cm->associationMappings AS $field => $assoc) {
|
||||
foreach ($cm->associationMappings as $field => $assoc) {
|
||||
fwrite($fh, " " . $field . " ");
|
||||
$value = $cm->reflFields[$field]->getValue($entity);
|
||||
|
||||
@ -97,12 +97,12 @@ class DebugUnitOfWorkListener
|
||||
fwrite($fh, " NULL\n");
|
||||
} else if ($initialized) {
|
||||
fwrite($fh, "[INITIALIZED] " . $this->getType($value). " " . count($value) . " elements\n");
|
||||
foreach ($value AS $obj) {
|
||||
foreach ($value as $obj) {
|
||||
fwrite($fh, " " . $this->getIdString($obj, $uow) . " " . spl_object_hash($obj)."\n");
|
||||
}
|
||||
} else {
|
||||
fwrite($fh, "[PROXY] " . $this->getType($value) . " unknown element size\n");
|
||||
foreach ($value->unwrap() AS $obj) {
|
||||
foreach ($value->unwrap() as $obj) {
|
||||
fwrite($fh, " " . $this->getIdString($obj, $uow) . " " . spl_object_hash($obj)."\n");
|
||||
}
|
||||
}
|
||||
@ -128,7 +128,7 @@ class DebugUnitOfWorkListener
|
||||
if ($uow->isInIdentityMap($entity)) {
|
||||
$ids = $uow->getEntityIdentifier($entity);
|
||||
$idstring = "";
|
||||
foreach ($ids AS $k => $v) {
|
||||
foreach ($ids as $k => $v) {
|
||||
$idstring .= $k."=".$v;
|
||||
}
|
||||
} else {
|
||||
|
@ -430,7 +430,7 @@ public function <methodName>()
|
||||
|
||||
$collections = array();
|
||||
|
||||
foreach ($metadata->associationMappings AS $mapping) {
|
||||
foreach ($metadata->associationMappings as $mapping) {
|
||||
if ($mapping['type'] & ClassMetadataInfo::TO_MANY) {
|
||||
$collections[] = '$this->'.$mapping['fieldName'].' = new \Doctrine\Common\Collections\ArrayCollection();';
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ class YamlExporter extends AbstractExporter
|
||||
}
|
||||
|
||||
if ($idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) {
|
||||
$ids[$metadata->getSingleIdentifierFieldName()]['generator']['strategy'] = $this->_getIdGeneratorTypeString($metadata->generatorType);
|
||||
$ids[$metadata->getSingleIdentifierFieldName()]['generator']['strategy'] = $idGeneratorType;
|
||||
}
|
||||
|
||||
if ($ids) {
|
||||
@ -129,7 +129,6 @@ class YamlExporter extends AbstractExporter
|
||||
$array['fields'] = array_merge($array['fields'], $fieldMappings);
|
||||
}
|
||||
|
||||
$associations = array();
|
||||
foreach ($metadata->associationMappings as $name => $associationMapping) {
|
||||
$cascade = array();
|
||||
if ($associationMapping['isCascadeRemove']) {
|
||||
|
@ -61,7 +61,7 @@ class ResolveTargetEntityListener
|
||||
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
|
||||
{
|
||||
$cm = $args->getClassMetadata();
|
||||
foreach ($cm->associationMappings as $assocName => $mapping) {
|
||||
foreach ($cm->associationMappings as $mapping) {
|
||||
if (isset($this->resolveTargetEntities[$mapping['targetEntity']])) {
|
||||
$this->remapAssociation($cm, $mapping);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user