diff --git a/lib/Doctrine/ORM/Mapping/AssociationMapping.php b/lib/Doctrine/ORM/Mapping/AssociationMapping.php index aba3efa0d..904106a20 100644 --- a/lib/Doctrine/ORM/Mapping/AssociationMapping.php +++ b/lib/Doctrine/ORM/Mapping/AssociationMapping.php @@ -70,6 +70,7 @@ abstract class AssociationMapping public $isCascadePersist; public $isCascadeRefresh; public $isCascadeMerge; + public $isCascadeDetach; /** * The fetch mode used for the association. @@ -188,6 +189,7 @@ abstract class AssociationMapping $this->isCascadePersist = in_array('persist', $this->cascades); $this->isCascadeRefresh = in_array('refresh', $this->cascades); $this->isCascadeMerge = in_array('merge', $this->cascades); + $this->isCascadeDetach = in_array('detach', $this->cascades); } /** @@ -234,6 +236,17 @@ abstract class AssociationMapping return $this->isCascadeMerge; } + /** + * Whether the association cascades detach() operations from the source entity + * to the target entity/entities. + * + * @return boolean + */ + public function isCascadeDetach() + { + return $this->isCascadeDetach; + } + /** * Whether the target entity/entities of the association are eagerly fetched. * diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadata.php b/lib/Doctrine/ORM/Mapping/ClassMetadata.php index 097fd3563..0cd637404 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadata.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadata.php @@ -26,6 +26,8 @@ use Doctrine\Common\DoctrineException; /** * A ClassMetadata instance holds all the ORM metadata of an entity and * it's associations. It is the backbone of Doctrine's metadata mapping. + * + * Once populated, ClassMetadata instances are usually cached in a serialized form. * * IMPORTANT NOTE: * diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index 5e194f8ee..9b41a9301 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -474,6 +474,9 @@ class SqlWalker implements TreeWalker } // Append foreign keys if necessary. + //FIXME: Evaluate HINT_INCLUDE_META_COLUMNS + //FIXME: Needs to be done in the case of Class Table Inheritance, too + // (see upper block of the if/else) if ( ! $this->_em->getConfiguration()->getAllowPartialObjects() && ! $this->_query->getHint(Query::HINT_FORCE_PARTIAL_LOAD)) { foreach ($class->associationMappings as $assoc) { @@ -1003,7 +1006,6 @@ class SqlWalker implements TreeWalker if ($literal instanceof AST\InputParameter) { $dqlParamKey = $literal->isNamed() ? $literal->getName() : $literal->getPosition(); $this->_parserResult->addParameterMapping($dqlParamKey, $this->_sqlParamIndex++); - //return ($literal->isNamed() ? ':' . $literal->getName() : '?'); return '?'; } else { return $literal; //TODO: quote() ? @@ -1045,7 +1047,6 @@ class SqlWalker implements TreeWalker $inputParam = $likeExpr->getStringPattern(); $dqlParamKey = $inputParam->isNamed() ? $inputParam->getName() : $inputParam->getPosition(); $this->_parserResult->addParameterMapping($dqlParamKey, $this->_sqlParamIndex++); - //$sql .= $inputParam->isNamed() ? ':' . $inputParam->getName() : '?'; $sql .= '?'; } else { $sql .= $this->_conn->quote($likeExpr->getStringPattern()); @@ -1172,7 +1173,6 @@ class SqlWalker implements TreeWalker if (is_numeric($primary)) { $sql .= $primary; //TODO: quote() ? } else if (is_string($primary)) { - //TODO: quote string according to platform $sql .= $this->_conn->quote($primary); } else if ($primary instanceof AST\SimpleArithmeticExpression) { $sql .= '(' . $this->walkSimpleArithmeticExpression($primary) . ')'; @@ -1212,12 +1212,6 @@ class SqlWalker implements TreeWalker $qComp = $this->_queryComponents[$dqlAlias]; $class = $qComp['metadata']; - /*if ($numParts > 2) { - for ($i = 1; $i < $numParts-1; ++$i) { - //TODO - } - }*/ - if ($this->_useSqlTableAliases) { if ($class->isInheritanceTypeJoined() && isset($class->fieldMappings[$fieldName]['inherited'])) { $sql .= $this->getSqlTableAlias($this->_em->getClassMetadata(