Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for DDC-1435 #159

Closed
wants to merge 1 commit into from

2 participants

Payam Hekmat Alexander
Payam Hekmat

Fix ClassMetadataInfo->getQuotedColumnName to correctly handle entity
FK as PK by looking for the field in association mappings in addition
to field mappings

Payam Hekmat phekmat Fix for DDC-1435
Fix ClassMetadataInfo->getQuotedColumnName to correctly handle entity
FK as PK by looking for the field in association mappings in addition
to field mappings
6702d13
Alexander
Collaborator

This issue was fixed: http://www.doctrine-project.org/jira/browse/DDC-1435.

I tried to verify by running the test you added and it succeeded.

Alexander asm89 closed this
elHornair elHornair referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 18, 2011
  1. Payam Hekmat

    Fix for DDC-1435

    phekmat authored
    Fix ClassMetadataInfo->getQuotedColumnName to correctly handle entity
    FK as PK by looking for the field in association mappings in addition
    to field mappings
This page is out of date. Refresh to see the latest.
77 lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
View
@@ -119,7 +119,7 @@ class ClassMetadataInfo implements ClassMetadata
const FETCH_LAZY = 2;
/**
* Specifies that an association is to be fetched when the owner of the
- * association is fetched.
+ * association is fetched.
*/
const FETCH_EAGER = 3;
/**
@@ -206,7 +206,7 @@ class ClassMetadataInfo implements ClassMetadata
/**
* READ-ONLY: The named queries allowed to be called directly from Repository.
- *
+ *
* @var array
*/
public $namedQueries = array();
@@ -361,7 +361,7 @@ class ClassMetadataInfo implements ClassMetadata
* - <b>mappedBy</b> (string, required for bidirectional associations)
* The name of the field that completes the bidirectional association on the owning side.
* This key must be specified on the inverse side of a bidirectional association.
- *
+ *
* - <b>inversedBy</b> (string, required for bidirectional associations)
* The name of the field that completes the bidirectional association on the inverse side.
* This key must be specified on the owning side of a bidirectional association.
@@ -388,7 +388,7 @@ class ClassMetadataInfo implements ClassMetadata
* Specification of a field on target-entity that is used to index the collection by.
* This field HAS to be either the primary key or a unique column. Otherwise the collection
* does not contain all the entities that are actually related.
- *
+ *
* A join table definition has the following structure:
* <pre>
* array(
@@ -430,7 +430,7 @@ class ClassMetadataInfo implements ClassMetadata
/**
* READ-ONLY: The definition of the sequence generator of this class. Only used for the
* SEQUENCE generation strategy.
- *
+ *
* The definition has the following structure:
* <code>
* array(
@@ -774,12 +774,12 @@ protected function _validateAndCompleteAssociationMapping(array $mapping)
// If targetEntity is unqualified, assume it is in the same namespace as
// the sourceEntity.
$mapping['sourceEntity'] = $this->name;
-
+
if (isset($mapping['targetEntity'])) {
if (strlen($this->namespace) > 0 && strpos($mapping['targetEntity'], '\\') === false) {
$mapping['targetEntity'] = $this->namespace . '\\' . $mapping['targetEntity'];
}
-
+
$mapping['targetEntity'] = ltrim($mapping['targetEntity'], '\\');
}
@@ -813,7 +813,7 @@ protected function _validateAndCompleteAssociationMapping(array $mapping)
if ( ! isset($mapping['targetEntity'])) {
throw MappingException::missingTargetEntity($mapping['fieldName']);
}
-
+
// Mandatory and optional attributes for either side
if ( ! $mapping['mappedBy']) {
if (isset($mapping['joinTable']) && $mapping['joinTable']) {
@@ -829,7 +829,7 @@ protected function _validateAndCompleteAssociationMapping(array $mapping)
if (isset($mapping['id']) && $mapping['id'] === true && $mapping['type'] & self::TO_MANY) {
throw MappingException::illegalToManyIdentifierAssoaction($this->name, $mapping['fieldName']);
}
-
+
// Fetch mode. Default fetch mode to LAZY, if not set.
if ( ! isset($mapping['fetch'])) {
$mapping['fetch'] = self::FETCH_LAZY;
@@ -837,18 +837,18 @@ protected function _validateAndCompleteAssociationMapping(array $mapping)
// Cascades
$cascades = isset($mapping['cascade']) ? array_map('strtolower', $mapping['cascade']) : array();
-
+
if (in_array('all', $cascades)) {
$cascades = array('remove', 'persist', 'refresh', 'merge', 'detach');
}
-
+
$mapping['cascade'] = $cascades;
$mapping['isCascadeRemove'] = in_array('remove', $cascades);
$mapping['isCascadePersist'] = in_array('persist', $cascades);
$mapping['isCascadeRefresh'] = in_array('refresh', $cascades);
$mapping['isCascadeMerge'] = in_array('merge', $cascades);
$mapping['isCascadeDetach'] = in_array('detach', $cascades);
-
+
return $mapping;
}
@@ -862,11 +862,11 @@ protected function _validateAndCompleteAssociationMapping(array $mapping)
protected function _validateAndCompleteOneToOneMapping(array $mapping)
{
$mapping = $this->_validateAndCompleteAssociationMapping($mapping);
-
+
if (isset($mapping['joinColumns']) && $mapping['joinColumns']) {
$mapping['isOwningSide'] = true;
}
-
+
if ($mapping['isOwningSide']) {
if ( ! isset($mapping['joinColumns']) || ! $mapping['joinColumns']) {
// Apply default join column
@@ -933,7 +933,7 @@ protected function _validateAndCompleteOneToManyMapping(array $mapping)
if ( ! isset($mapping['mappedBy'])) {
throw MappingException::oneToManyRequiresMappedBy($mapping['fieldName']);
}
-
+
$mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ? (bool) $mapping['orphanRemoval'] : false;
$mapping['isCascadeRemove'] = $mapping['orphanRemoval'] ? true : $mapping['isCascadeRemove'];
@@ -942,7 +942,7 @@ protected function _validateAndCompleteOneToManyMapping(array $mapping)
throw new \InvalidArgumentException("'orderBy' is expected to be an array, not ".gettype($mapping['orderBy']));
}
}
-
+
return $mapping;
}
@@ -960,7 +960,7 @@ protected function _validateAndCompleteManyToManyMapping(array $mapping)
} else {
$targetShortName = strtolower($mapping['targetEntity']);
}
-
+
// owning side MUST have a join table
if ( ! isset($mapping['joinTable']['name'])) {
$mapping['joinTable']['name'] = $sourceShortName .'_' . $targetShortName;
@@ -1369,11 +1369,11 @@ public function setPrimaryTable(array $table)
$this->table['name'] = $table['name'];
}
}
-
+
if (isset($table['indexes'])) {
$this->table['indexes'] = $table['indexes'];
}
-
+
if (isset($table['uniqueConstraints'])) {
$this->table['uniqueConstraints'] = $table['uniqueConstraints'];
}
@@ -1522,7 +1522,7 @@ protected function _storeAssociationMapping(array $assocMapping)
*/
public function setCustomRepositoryClass($repositoryClassName)
{
- if ($repositoryClassName !== null && strpos($repositoryClassName, '\\') === false
+ if ($repositoryClassName !== null && strpos($repositoryClassName, '\\') === false
&& strlen($this->namespace) > 0) {
$repositoryClassName = $this->namespace . '\\' . $repositoryClassName;
}
@@ -1722,7 +1722,7 @@ public function isAssociationWithSingleJoinColumn($fieldName)
/**
* Return the single association join column (if any).
- *
+ *
* @param string $fieldName
* @return string
*/
@@ -1764,7 +1764,7 @@ public function getFieldForColumn($columnName)
foreach ($this->associationMappings AS $assocName => $mapping) {
if ($this->isAssociationWithSingleJoinColumn($assocName) &&
$this->associationMappings[$assocName]['joinColumns'][0]['name'] == $columnName) {
-
+
return $assocName;
}
}
@@ -1854,34 +1854,34 @@ public function markReadOnly()
{
$this->isReadOnly = true;
}
-
+
/**
* A numerically indexed list of field names of this persistent class.
- *
+ *
* This array includes identifier fields if present on this class.
- *
+ *
* @return array
*/
public function getFieldNames()
{
return array_keys($this->fieldMappings);
}
-
+
/**
* A numerically indexed list of association names of this persistent class.
- *
+ *
* This array includes identifier associations if present on this class.
- *
+ *
* @return array
*/
public function getAssociationNames()
{
return array_keys($this->associationMappings);
}
-
+
/**
* Returns the target class name of the given association.
- *
+ *
* @param string $assocName
* @return string
*/
@@ -1890,13 +1890,13 @@ public function getAssociationTargetClass($assocName)
if ( ! isset($this->associationMappings[$assocName])) {
throw new \InvalidArgumentException("Association name expected, '" . $assocName ."' is not an association.");
}
-
+
return $this->associationMappings[$assocName]['targetEntity'];
}
-
+
/**
* Get fully-qualified class name of this persistent class.
- *
+ *
* @return string
*/
public function getName()
@@ -1907,20 +1907,25 @@ public function getName()
/**
* Gets the (possibly quoted) column name of a mapped field for safe use
* in an SQL statement.
- *
+ *
* @param string $field
* @param AbstractPlatform $platform
* @return string
*/
public function getQuotedColumnName($field, $platform)
{
+ if (isset($this->associationMappings[$field])) {
+ // no composite pk as fk entity assumption:
+ $mapping = $this->associationMappings[$field]['joinColumns'][0];
+ return isset($mapping['quoted']) ? $platform->quoteIdentifier($mapping['name']) : $mapping['name'];
+ }
return isset($this->fieldMappings[$field]['quoted']) ? $platform->quoteIdentifier($this->fieldMappings[$field]['columnName']) : $this->fieldMappings[$field]['columnName'];
}
-
+
/**
* Gets the (possibly quoted) primary table name of this class for safe use
* in an SQL statement.
- *
+ *
* @param AbstractPlatform $platform
* @return string
*/
43 tests/Doctrine/Tests/Models/CMS/CmsArticleTag.php
View
@@ -0,0 +1,43 @@
+<?php
+
+namespace Doctrine\Tests\Models\CMS;
+
+/**
+ * @Entity
+ * @Table(name="cms_article_tags")
+ */
+class CmsArticleTag
+{
+ /**
+ * @Id
+ * @Column(type="string", length=255)
+ */
+ private $tag;
+
+ /**
+ * @Id
+ * @ManyToOne(targetEntity="CmsArticle");
+ */
+ private $article;
+
+
+ public function getTag()
+ {
+ return $this->tag;
+ }
+
+ public function setTag($tag)
+ {
+ $this->tag = $tag;
+ }
+
+ public function getArticle()
+ {
+ return $this->article;
+ }
+
+ public function setArticle($article)
+ {
+ $this->article = $article;
+ }
+}
137 tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php
View
@@ -17,11 +17,11 @@ protected function setUp()
/**
* Assert a valid SQL generation.
- *
+ *
* @param string $dqlToBeTested
* @param string $sqlToBeConfirmed
* @param array $queryHints
- * @param array $queryParams
+ * @param array $queryParams
*/
public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed, array $queryHints = array(), array $queryParams = array())
{
@@ -34,11 +34,11 @@ public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed, array $qu
$query->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true)
->useQueryCache(false);
-
+
foreach ($queryHints AS $name => $value) {
$query->setHint($name, $value);
}
-
+
parent::assertEquals($sqlToBeConfirmed, $query->getSQL());
$query->free();
} catch (\Exception $e) {
@@ -383,7 +383,7 @@ public function testSupportsInstanceOfExpressionsInWherePart()
"SELECT c0_.id AS id0, c0_.name AS name1, c0_.discr AS discr2 FROM company_persons c0_ WHERE c0_.discr IN ('employee')"
);
}
-
+
public function testSupportsInstanceOfExpressionInWherePartWithMultipleValues()
{
$this->assertSqlGeneration(
@@ -391,7 +391,7 @@ public function testSupportsInstanceOfExpressionInWherePartWithMultipleValues()
"SELECT c0_.id AS id0, c0_.name AS name1, c0_.discr AS discr2 FROM company_persons c0_ WHERE c0_.discr IN ('employee', 'manager')"
);
}
-
+
/**
* @group DDC-1194
*/
@@ -402,7 +402,7 @@ public function testSupportsInstanceOfExpressionsInWherePartPrefixedSlash()
"SELECT c0_.id AS id0, c0_.name AS name1, c0_.discr AS discr2 FROM company_persons c0_ WHERE c0_.discr IN ('employee')"
);
}
-
+
/**
* @group DDC-1194
*/
@@ -608,6 +608,27 @@ public function testExistsExpressionInWhereCorrelatedSubqueryAssocCondition()
);
}
+ /**
+ * @group DDC-1435
+ */
+ public function testSubselectWithEntityForeignKeyInPrimaryKey()
+ {
+ $this->assertSqlGeneration(
+ // DQL
+ 'SELECT DISTINCT art FROM Doctrine\Tests\Models\CMS\CmsArticle art
+ WHERE EXISTS (
+ SELECT artTag
+ FROM Doctrine\Tests\Models\CMS\CmsArticleTag artTag
+ WHERE artTag.article = art)',
+ // SQL
+ 'SELECT DISTINCT c0_.id AS id0, c0_.topic AS topic1, c0_.text AS text2, c0_.version AS version3 FROM cms_articles c0_'
+ . ' WHERE EXISTS ('
+ . 'SELECT c1_.tag, c1_.article_id FROM cms_article_tags c1_ WHERE c1_.article_id = c0_.id'
+ . ')'
+
+ );
+ }
+
public function testLimitFromQueryClass()
{
$q = $this->_em
@@ -686,7 +707,7 @@ public function testOrderByCollectionAssociationSize()
"SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3, (SELECT COUNT(*) FROM cms_articles c1_ WHERE c1_.user_id = c0_.id) AS sclr4 FROM cms_users c0_ ORDER BY sclr4 ASC"
);
}
-
+
public function testOrderBySupportsSingleValuedPathExpressionOwningSide()
{
$this->assertSqlGeneration(
@@ -694,7 +715,7 @@ public function testOrderBySupportsSingleValuedPathExpressionOwningSide()
"SELECT c0_.id AS id0, c0_.topic AS topic1, c0_.text AS text2, c0_.version AS version3 FROM cms_articles c0_ ORDER BY c0_.user_id ASC"
);
}
-
+
/**
* @expectedException Doctrine\ORM\Query\QueryException
*/
@@ -931,7 +952,7 @@ public function testGroupByIdentificationVariable()
'SELECT c0_.id AS id0, c0_.name AS name1, count(c1_.id) AS sclr2 FROM cms_groups c0_ INNER JOIN cms_users_groups c2_ ON c0_.id = c2_.group_id INNER JOIN cms_users c1_ ON c1_.id = c2_.user_id GROUP BY c0_.id'
);
}
-
+
public function testCaseContainingNullIf()
{
$this->assertSqlGeneration(
@@ -939,7 +960,7 @@ public function testCaseContainingNullIf()
'SELECT NULLIF(c0_.id, c0_.name) AS sclr0 FROM cms_groups c0_'
);
}
-
+
public function testCaseContainingCoalesce()
{
$this->assertSqlGeneration(
@@ -1009,244 +1030,244 @@ public function testSelectForeignKeyPKWithoutFields()
"SELECT d0_.article_id AS article_id0, d0_.title AS title1, d1_.article_id AS article_id2, d1_.title AS title3 FROM DDC117Link d2_ INNER JOIN DDC117Article d0_ ON d2_.target_id = d0_.article_id INNER JOIN DDC117Article d1_ ON d2_.source_id = d1_.article_id"
);
}
-
+
public function testGeneralCaseWithSingleWhenClause()
{
$this->assertSqlGeneration(
- "SELECT g.id, CASE WHEN ((g.id / 2) > 18) THEN 1 ELSE 0 END AS test FROM Doctrine\Tests\Models\CMS\CmsGroup g",
+ "SELECT g.id, CASE WHEN ((g.id / 2) > 18) THEN 1 ELSE 0 END AS test FROM Doctrine\Tests\Models\CMS\CmsGroup g",
"SELECT c0_.id AS id0, CASE WHEN (c0_.id / 2 > 18) THEN 1 ELSE 0 END AS sclr1 FROM cms_groups c0_"
);
}
-
+
public function testGeneralCaseWithMultipleWhenClause()
{
$this->assertSqlGeneration(
- "SELECT g.id, CASE WHEN (g.id / 2 < 10) THEN 2 WHEN ((g.id / 2) > 20) THEN 1 ELSE 0 END AS test FROM Doctrine\Tests\Models\CMS\CmsGroup g",
+ "SELECT g.id, CASE WHEN (g.id / 2 < 10) THEN 2 WHEN ((g.id / 2) > 20) THEN 1 ELSE 0 END AS test FROM Doctrine\Tests\Models\CMS\CmsGroup g",
"SELECT c0_.id AS id0, CASE WHEN (c0_.id / 2 < 10) THEN 2 WHEN (c0_.id / 2 > 20) THEN 1 ELSE 0 END AS sclr1 FROM cms_groups c0_"
);
}
-
+
public function testSimpleCaseWithSingleWhenClause()
{
$this->assertSqlGeneration(
- "SELECT g FROM Doctrine\Tests\Models\CMS\CmsGroup g WHERE g.id = CASE g.name WHEN 'admin' THEN 1 ELSE 2 END",
+ "SELECT g FROM Doctrine\Tests\Models\CMS\CmsGroup g WHERE g.id = CASE g.name WHEN 'admin' THEN 1 ELSE 2 END",
"SELECT c0_.id AS id0, c0_.name AS name1 FROM cms_groups c0_ WHERE c0_.id = CASE c0_.name WHEN admin THEN 1 ELSE 2 END"
);
}
-
+
public function testSimpleCaseWithMultipleWhenClause()
{
$this->assertSqlGeneration(
- "SELECT g FROM Doctrine\Tests\Models\CMS\CmsGroup g WHERE g.id = (CASE g.name WHEN 'admin' THEN 1 WHEN 'moderator' THEN 2 ELSE 3 END)",
+ "SELECT g FROM Doctrine\Tests\Models\CMS\CmsGroup g WHERE g.id = (CASE g.name WHEN 'admin' THEN 1 WHEN 'moderator' THEN 2 ELSE 3 END)",
"SELECT c0_.id AS id0, c0_.name AS name1 FROM cms_groups c0_ WHERE c0_.id = CASE c0_.name WHEN admin THEN 1 WHEN moderator THEN 2 ELSE 3 END"
);
}
-
+
public function testGeneralCaseWithSingleWhenClauseInSubselect()
{
$this->assertSqlGeneration(
- "SELECT g FROM Doctrine\Tests\Models\CMS\CmsGroup g WHERE g.id IN (SELECT CASE WHEN ((g2.id / 2) > 18) THEN 2 ELSE 1 END FROM Doctrine\Tests\Models\CMS\CmsGroup g2)",
+ "SELECT g FROM Doctrine\Tests\Models\CMS\CmsGroup g WHERE g.id IN (SELECT CASE WHEN ((g2.id / 2) > 18) THEN 2 ELSE 1 END FROM Doctrine\Tests\Models\CMS\CmsGroup g2)",
"SELECT c0_.id AS id0, c0_.name AS name1 FROM cms_groups c0_ WHERE c0_.id IN (SELECT CASE WHEN (c1_.id / 2 > 18) THEN 2 ELSE 1 END AS sclr2 FROM cms_groups c1_)"
);
}
-
+
public function testGeneralCaseWithMultipleWhenClauseInSubselect()
{
$this->assertSqlGeneration(
- "SELECT g FROM Doctrine\Tests\Models\CMS\CmsGroup g WHERE g.id IN (SELECT CASE WHEN (g.id / 2 < 10) THEN 3 WHEN ((g.id / 2) > 20) THEN 2 ELSE 1 END FROM Doctrine\Tests\Models\CMS\CmsGroup g2)",
+ "SELECT g FROM Doctrine\Tests\Models\CMS\CmsGroup g WHERE g.id IN (SELECT CASE WHEN (g.id / 2 < 10) THEN 3 WHEN ((g.id / 2) > 20) THEN 2 ELSE 1 END FROM Doctrine\Tests\Models\CMS\CmsGroup g2)",
"SELECT c0_.id AS id0, c0_.name AS name1 FROM cms_groups c0_ WHERE c0_.id IN (SELECT CASE WHEN (c0_.id / 2 < 10) THEN 3 WHEN (c0_.id / 2 > 20) THEN 2 ELSE 1 END AS sclr2 FROM cms_groups c1_)"
);
}
-
+
public function testSimpleCaseWithSingleWhenClauseInSubselect()
{
$this->assertSqlGeneration(
- "SELECT g FROM Doctrine\Tests\Models\CMS\CmsGroup g WHERE g.id IN (SELECT CASE g2.name WHEN 'admin' THEN 1 ELSE 2 END FROM Doctrine\Tests\Models\CMS\CmsGroup g2)",
+ "SELECT g FROM Doctrine\Tests\Models\CMS\CmsGroup g WHERE g.id IN (SELECT CASE g2.name WHEN 'admin' THEN 1 ELSE 2 END FROM Doctrine\Tests\Models\CMS\CmsGroup g2)",
"SELECT c0_.id AS id0, c0_.name AS name1 FROM cms_groups c0_ WHERE c0_.id IN (SELECT CASE c1_.name WHEN admin THEN 1 ELSE 2 END AS sclr2 FROM cms_groups c1_)"
);
}
-
+
public function testSimpleCaseWithMultipleWhenClauseInSubselect()
{
$this->assertSqlGeneration(
- "SELECT g FROM Doctrine\Tests\Models\CMS\CmsGroup g WHERE g.id IN (SELECT CASE g2.name WHEN 'admin' THEN 1 WHEN 'moderator' THEN 2 ELSE 3 END FROM Doctrine\Tests\Models\CMS\CmsGroup g2)",
+ "SELECT g FROM Doctrine\Tests\Models\CMS\CmsGroup g WHERE g.id IN (SELECT CASE g2.name WHEN 'admin' THEN 1 WHEN 'moderator' THEN 2 ELSE 3 END FROM Doctrine\Tests\Models\CMS\CmsGroup g2)",
"SELECT c0_.id AS id0, c0_.name AS name1 FROM cms_groups c0_ WHERE c0_.id IN (SELECT CASE c1_.name WHEN admin THEN 1 WHEN moderator THEN 2 ELSE 3 END AS sclr2 FROM cms_groups c1_)"
);
}
-
+
/**
* @group DDC-1339
*/
public function testIdentityFunctionInSelectClause()
{
$this->assertSqlGeneration(
- "SELECT IDENTITY(u.email) as email_id FROM Doctrine\Tests\Models\CMS\CmsUser u",
+ "SELECT IDENTITY(u.email) as email_id FROM Doctrine\Tests\Models\CMS\CmsUser u",
"SELECT c0_.email_id AS sclr0 FROM cms_users c0_"
);
}
-
+
/**
* @group DDC-1339
*/
public function testIdentityFunctionDoesNotAcceptStateField()
{
$this->assertInvalidSqlGeneration(
- "SELECT IDENTITY(u.name) as name FROM Doctrine\Tests\Models\CMS\CmsUser u",
+ "SELECT IDENTITY(u.name) as name FROM Doctrine\Tests\Models\CMS\CmsUser u",
"Doctrine\ORM\Query\QueryException"
);
}
-
+
/**
* @group DDC-1389
*/
public function testInheritanceTypeJoinInRootClassWithDisabledForcePartialLoad()
{
$this->assertSqlGeneration(
- 'SELECT p FROM Doctrine\Tests\Models\Company\CompanyPerson p',
+ 'SELECT p FROM Doctrine\Tests\Models\Company\CompanyPerson p',
'SELECT c0_.id AS id0, c0_.name AS name1, c1_.title AS title2, c1_.car_id AS car_id3, c2_.salary AS salary4, c2_.department AS department5, c2_.startDate AS startDate6, c0_.discr AS discr7, c0_.spouse_id AS spouse_id8 FROM company_persons c0_ LEFT JOIN company_managers c1_ ON c0_.id = c1_.id LEFT JOIN company_employees c2_ ON c0_.id = c2_.id',
array(Query::HINT_FORCE_PARTIAL_LOAD => false)
);
}
-
+
/**
* @group DDC-1389
*/
public function testInheritanceTypeJoinInRootClassWithEnabledForcePartialLoad()
{
$this->assertSqlGeneration(
- 'SELECT p FROM Doctrine\Tests\Models\Company\CompanyPerson p',
+ 'SELECT p FROM Doctrine\Tests\Models\Company\CompanyPerson p',
'SELECT c0_.id AS id0, c0_.name AS name1, c0_.discr AS discr2 FROM company_persons c0_',
array(Query::HINT_FORCE_PARTIAL_LOAD => true)
);
}
-
+
/**
* @group DDC-1389
*/
public function testInheritanceTypeJoinInChildClassWithDisabledForcePartialLoad()
{
$this->assertSqlGeneration(
- 'SELECT e FROM Doctrine\Tests\Models\Company\CompanyEmployee e',
+ 'SELECT e FROM Doctrine\Tests\Models\Company\CompanyEmployee e',
'SELECT c0_.id AS id0, c0_.name AS name1, c1_.salary AS salary2, c1_.department AS department3, c1_.startDate AS startDate4, c2_.title AS title5, c2_.car_id AS car_id6, c0_.discr AS discr7, c0_.spouse_id AS spouse_id8 FROM company_employees c1_ INNER JOIN company_persons c0_ ON c1_.id = c0_.id LEFT JOIN company_managers c2_ ON c1_.id = c2_.id',
array(Query::HINT_FORCE_PARTIAL_LOAD => false)
);
}
-
+
/**
* @group DDC-1389
*/
public function testInheritanceTypeJoinInChildClassWithEnabledForcePartialLoad()
{
$this->assertSqlGeneration(
- 'SELECT e FROM Doctrine\Tests\Models\Company\CompanyEmployee e',
+ 'SELECT e FROM Doctrine\Tests\Models\Company\CompanyEmployee e',
'SELECT c0_.id AS id0, c0_.name AS name1, c1_.salary AS salary2, c1_.department AS department3, c1_.startDate AS startDate4, c0_.discr AS discr5 FROM company_employees c1_ INNER JOIN company_persons c0_ ON c1_.id = c0_.id',
array(Query::HINT_FORCE_PARTIAL_LOAD => true)
);
}
-
+
/**
* @group DDC-1389
*/
public function testInheritanceTypeJoinInLeafClassWithDisabledForcePartialLoad()
{
$this->assertSqlGeneration(
- 'SELECT m FROM Doctrine\Tests\Models\Company\CompanyManager m',
+ 'SELECT m FROM Doctrine\Tests\Models\Company\CompanyManager m',
'SELECT c0_.id AS id0, c0_.name AS name1, c1_.salary AS salary2, c1_.department AS department3, c1_.startDate AS startDate4, c2_.title AS title5, c0_.discr AS discr6, c0_.spouse_id AS spouse_id7, c2_.car_id AS car_id8 FROM company_managers c2_ INNER JOIN company_employees c1_ ON c2_.id = c1_.id INNER JOIN company_persons c0_ ON c2_.id = c0_.id',
array(Query::HINT_FORCE_PARTIAL_LOAD => false)
);
}
-
+
/**
* @group DDC-1389
*/
public function testInheritanceTypeJoinInLeafClassWithEnabledForcePartialLoad()
{
$this->assertSqlGeneration(
- 'SELECT m FROM Doctrine\Tests\Models\Company\CompanyManager m',
+ 'SELECT m FROM Doctrine\Tests\Models\Company\CompanyManager m',
'SELECT c0_.id AS id0, c0_.name AS name1, c1_.salary AS salary2, c1_.department AS department3, c1_.startDate AS startDate4, c2_.title AS title5, c0_.discr AS discr6 FROM company_managers c2_ INNER JOIN company_employees c1_ ON c2_.id = c1_.id INNER JOIN company_persons c0_ ON c2_.id = c0_.id',
array(Query::HINT_FORCE_PARTIAL_LOAD => true)
);
}
-
+
/**
* @group DDC-1389
*/
public function testInheritanceTypeSingleTableInRootClassWithDisabledForcePartialLoad()
{
$this->assertSqlGeneration(
- 'SELECT c FROM Doctrine\Tests\Models\Company\CompanyContract c',
+ 'SELECT c FROM Doctrine\Tests\Models\Company\CompanyContract c',
"SELECT c0_.id AS id0, c0_.completed AS completed1, c0_.fixPrice AS fixPrice2, c0_.hoursWorked AS hoursWorked3, c0_.pricePerHour AS pricePerHour4, c0_.maxPrice AS maxPrice5, c0_.discr AS discr6, c0_.salesPerson_id AS salesPerson_id7 FROM company_contracts c0_ WHERE c0_.discr IN ('fix', 'flexible', 'flexultra')",
array(Query::HINT_FORCE_PARTIAL_LOAD => false)
);
}
-
+
/**
* @group DDC-1389
*/
public function testInheritanceTypeSingleTableInRootClassWithEnabledForcePartialLoad()
{
$this->assertSqlGeneration(
- 'SELECT c FROM Doctrine\Tests\Models\Company\CompanyContract c',
+ 'SELECT c FROM Doctrine\Tests\Models\Company\CompanyContract c',
"SELECT c0_.id AS id0, c0_.completed AS completed1, c0_.fixPrice AS fixPrice2, c0_.hoursWorked AS hoursWorked3, c0_.pricePerHour AS pricePerHour4, c0_.maxPrice AS maxPrice5, c0_.discr AS discr6 FROM company_contracts c0_ WHERE c0_.discr IN ('fix', 'flexible', 'flexultra')",
array(Query::HINT_FORCE_PARTIAL_LOAD => true)
);
}
-
+
/**
* @group DDC-1389
*/
public function testInheritanceTypeSingleTableInChildClassWithDisabledForcePartialLoad()
{
$this->assertSqlGeneration(
- 'SELECT fc FROM Doctrine\Tests\Models\Company\CompanyFlexContract fc',
+ 'SELECT fc FROM Doctrine\Tests\Models\Company\CompanyFlexContract fc',
"SELECT c0_.id AS id0, c0_.completed AS completed1, c0_.hoursWorked AS hoursWorked2, c0_.pricePerHour AS pricePerHour3, c0_.maxPrice AS maxPrice4, c0_.discr AS discr5, c0_.salesPerson_id AS salesPerson_id6 FROM company_contracts c0_ WHERE c0_.discr IN ('flexible', 'flexultra')",
array(Query::HINT_FORCE_PARTIAL_LOAD => false)
);
}
-
+
/**
* @group DDC-1389
*/
public function testInheritanceTypeSingleTableInChildClassWithEnabledForcePartialLoad()
{
$this->assertSqlGeneration(
- 'SELECT fc FROM Doctrine\Tests\Models\Company\CompanyFlexContract fc',
+ 'SELECT fc FROM Doctrine\Tests\Models\Company\CompanyFlexContract fc',
"SELECT c0_.id AS id0, c0_.completed AS completed1, c0_.hoursWorked AS hoursWorked2, c0_.pricePerHour AS pricePerHour3, c0_.maxPrice AS maxPrice4, c0_.discr AS discr5 FROM company_contracts c0_ WHERE c0_.discr IN ('flexible', 'flexultra')",
array(Query::HINT_FORCE_PARTIAL_LOAD => true)
);
}
-
+
/**
* @group DDC-1389
*/
public function testInheritanceTypeSingleTableInLeafClassWithDisabledForcePartialLoad()
{
$this->assertSqlGeneration(
- 'SELECT fuc FROM Doctrine\Tests\Models\Company\CompanyFlexUltraContract fuc',
+ 'SELECT fuc FROM Doctrine\Tests\Models\Company\CompanyFlexUltraContract fuc',
"SELECT c0_.id AS id0, c0_.completed AS completed1, c0_.hoursWorked AS hoursWorked2, c0_.pricePerHour AS pricePerHour3, c0_.maxPrice AS maxPrice4, c0_.discr AS discr5, c0_.salesPerson_id AS salesPerson_id6 FROM company_contracts c0_ WHERE c0_.discr IN ('flexultra')",
array(Query::HINT_FORCE_PARTIAL_LOAD => false)
);
}
-
+
/**
* @group DDC-1389
*/
public function testInheritanceTypeSingleTableInLeafClassWithEnabledForcePartialLoad()
{
$this->assertSqlGeneration(
- 'SELECT fuc FROM Doctrine\Tests\Models\Company\CompanyFlexUltraContract fuc',
+ 'SELECT fuc FROM Doctrine\Tests\Models\Company\CompanyFlexUltraContract fuc',
"SELECT c0_.id AS id0, c0_.completed AS completed1, c0_.hoursWorked AS hoursWorked2, c0_.pricePerHour AS pricePerHour3, c0_.maxPrice AS maxPrice4, c0_.discr AS discr5 FROM company_contracts c0_ WHERE c0_.discr IN ('flexultra')",
array(Query::HINT_FORCE_PARTIAL_LOAD => true)
);
}
-
+
/**
* @group DDC-1161
*/
public function testSelfReferenceWithOneToOneDoesNotDuplicateAlias()
{
$this->assertSqlGeneration(
- 'SELECT p, pp FROM Doctrine\Tests\Models\Company\CompanyPerson p JOIN p.spouse pp',
+ 'SELECT p, pp FROM Doctrine\Tests\Models\Company\CompanyPerson p JOIN p.spouse pp',
"SELECT c0_.id AS id0, c0_.name AS name1, c1_.title AS title2, c1_.car_id AS car_id3, c2_.salary AS salary4, c2_.department AS department5, c2_.startDate AS startDate6, c3_.id AS id7, c3_.name AS name8, c4_.title AS title9, c4_.car_id AS car_id10, c5_.salary AS salary11, c5_.department AS department12, c5_.startDate AS startDate13, c0_.discr AS discr14, c0_.spouse_id AS spouse_id15, c3_.discr AS discr16, c3_.spouse_id AS spouse_id17 FROM company_persons c0_ LEFT JOIN company_managers c1_ ON c0_.id = c1_.id LEFT JOIN company_employees c2_ ON c0_.id = c2_.id INNER JOIN company_persons c3_ ON c0_.spouse_id = c3_.id LEFT JOIN company_managers c4_ ON c3_.id = c4_.id LEFT JOIN company_employees c5_ ON c3_.id = c5_.id",
array(Query::HINT_FORCE_PARTIAL_LOAD => false)
);
@@ -1277,7 +1298,7 @@ public function parse(\Doctrine\ORM\Query\Parser $parser)
$parser->match(\Doctrine\ORM\Query\Lexer::T_OPEN_PARENTHESIS);
$this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
-
+
$parser->match(\Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS);
}
}
Something went wrong with that request. Please try again.