Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
01c2c06b
Commit
01c2c06b
authored
Apr 15, 2010
by
Roman S. Borschel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DDC-512] Fixed.
parent
29e0863f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
103 additions
and
26 deletions
+103
-26
Configuration.php
lib/Doctrine/DBAL/Configuration.php
+0
-3
SingleTablePersister.php
lib/Doctrine/ORM/Persisters/SingleTablePersister.php
+0
-1
PathExpression.php
lib/Doctrine/ORM/Query/AST/PathExpression.php
+0
-5
Parser.php
lib/Doctrine/ORM/Query/Parser.php
+0
-5
SqlWalker.php
lib/Doctrine/ORM/Query/SqlWalker.php
+7
-9
CompanyEvent.php
tests/Doctrine/Tests/Models/Company/CompanyEvent.php
+2
-2
ClassTableInheritanceTest.php
...ctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php
+0
-1
DDC512Test.php
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php
+94
-0
No files found.
lib/Doctrine/DBAL/Configuration.php
View file @
01c2c06b
...
...
@@ -24,10 +24,7 @@ use Doctrine\DBAL\Logging\SQLLogger;
/**
* Configuration container for the Doctrine DBAL.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
...
...
lib/Doctrine/ORM/Persisters/SingleTablePersister.php
View file @
01c2c06b
...
...
@@ -26,7 +26,6 @@ use Doctrine\ORM\Mapping\ClassMetadata;
* SINGLE_TABLE strategy.
*
* @author Roman Borschel <roman@code-factory.org>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @since 2.0
* @link http://martinfowler.com/eaaCatalog/singleTableInheritance.html
*/
...
...
lib/Doctrine/ORM/Query/AST/PathExpression.php
View file @
01c2c06b
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
...
...
@@ -31,10 +29,7 @@ namespace Doctrine\ORM\Query\AST;
* SimpleStateFieldPathExpression ::= IdentificationVariable "." StateField
* SimpleStateFieldAssociationPathExpression ::= SingleValuedAssociationPathExpression "." StateField
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
...
...
lib/Doctrine/ORM/Query/Parser.php
View file @
01c2c06b
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
...
...
@@ -27,10 +25,7 @@ use Doctrine\ORM\Query;
* An LL(*) recursive-descent parser for the context-free grammar of the Doctrine Query Language.
* Parses a DQL query, reports any errors in it, and generates an AST.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
...
...
lib/Doctrine/ORM/Query/SqlWalker.php
View file @
01c2c06b
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
...
...
@@ -240,16 +238,17 @@ class SqlWalker implements TreeWalker
{
$sql
=
''
;
$baseTableAlias
=
$this
->
getS
ql
TableAlias
(
$class
->
table
[
'name'
],
$dqlAlias
);
$baseTableAlias
=
$this
->
getS
QL
TableAlias
(
$class
->
table
[
'name'
],
$dqlAlias
);
// INNER JOIN parent class tables
foreach
(
$class
->
parentClasses
as
$parentClassName
)
{
$parentClass
=
$this
->
_em
->
getClassMetadata
(
$parentClassName
);
$tableAlias
=
$this
->
getSqlTableAlias
(
$parentClass
->
table
[
'name'
],
$dqlAlias
);
$sql
.=
' INNER JOIN '
.
$parentClass
->
getQuotedTableName
(
$this
->
_platform
)
$tableAlias
=
$this
->
getSQLTableAlias
(
$parentClass
->
table
[
'name'
],
$dqlAlias
);
// If this is a joined association we must use left joins to preserve the correct result.
$sql
.=
isset
(
$this
->
_queryComponents
[
$dqlAlias
][
'relation'
])
?
' LEFT '
:
' INNER '
;
$sql
.=
'JOIN '
.
$parentClass
->
getQuotedTableName
(
$this
->
_platform
)
.
' '
.
$tableAlias
.
' ON '
;
$first
=
true
;
foreach
(
$class
->
identifier
as
$idField
)
{
if
(
$first
)
$first
=
false
;
else
$sql
.=
' AND '
;
...
...
@@ -260,14 +259,13 @@ class SqlWalker implements TreeWalker
}
}
// LEFT JOIN subclass tables, if partial objects disallowed
// LEFT JOIN subclass tables, if partial objects disallowed
.
if
(
!
$this
->
_query
->
getHint
(
Query
::
HINT_FORCE_PARTIAL_LOAD
))
{
foreach
(
$class
->
subClasses
as
$subClassName
)
{
$subClass
=
$this
->
_em
->
getClassMetadata
(
$subClassName
);
$tableAlias
=
$this
->
getS
ql
TableAlias
(
$subClass
->
table
[
'name'
],
$dqlAlias
);
$tableAlias
=
$this
->
getS
QL
TableAlias
(
$subClass
->
table
[
'name'
],
$dqlAlias
);
$sql
.=
' LEFT JOIN '
.
$subClass
->
getQuotedTableName
(
$this
->
_platform
)
.
' '
.
$tableAlias
.
' ON '
;
$first
=
true
;
foreach
(
$class
->
identifier
as
$idField
)
{
if
(
$first
)
$first
=
false
;
else
$sql
.=
' AND '
;
...
...
tests/Doctrine/Tests/Models/Company/CompanyEvent.php
View file @
01c2c06b
...
...
@@ -6,9 +6,9 @@ namespace Doctrine\Tests\Models\Company;
* @Entity @Table(name="company_events")
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="event_type", type="string")
* @DiscriminatorMap({"auction"
= "CompanyAuction", "raffle" =
"CompanyRaffle"})
* @DiscriminatorMap({"auction"
="CompanyAuction", "raffle"=
"CompanyRaffle"})
*/
class
CompanyEvent
{
abstract
class
CompanyEvent
{
/**
* @Id @Column(type="integer")
* @GeneratedValue
...
...
tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php
View file @
01c2c06b
...
...
@@ -294,5 +294,4 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
->
getResult
())
>
0
);
}
}
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php
0 → 100644
View file @
01c2c06b
<?php
namespace
Doctrine\Tests\ORM\Functional\Ticket
;
require_once
__DIR__
.
'/../../../TestInit.php'
;
class
DDC512Test
extends
\Doctrine\Tests\OrmFunctionalTestCase
{
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
_schemaTool
->
createSchema
(
array
(
$this
->
_em
->
getClassMetadata
(
__NAMESPACE__
.
'\DDC512Customer'
),
$this
->
_em
->
getClassMetadata
(
__NAMESPACE__
.
'\DDC512OfferItem'
),
$this
->
_em
->
getClassMetadata
(
__NAMESPACE__
.
'\DDC512Item'
),
));
}
public
function
testIssue
()
{
$customer1
=
new
DDC512Customer
();
$item
=
new
DDC512OfferItem
();
$customer1
->
item
=
$item
;
$this
->
_em
->
persist
(
$customer1
);
$customer2
=
new
DDC512Customer
();
$this
->
_em
->
persist
(
$customer2
);
$this
->
_em
->
flush
();
$this
->
_em
->
clear
();
$q
=
$this
->
_em
->
createQuery
(
"select u,i from "
.
__NAMESPACE__
.
"
\\
DDC512Customer u left join u.item i"
);
$result
=
$q
->
getResult
();
$this
->
assertEquals
(
2
,
count
(
$result
));
$this
->
assertTrue
(
$result
[
0
]
instanceof
DDC512Customer
);
$this
->
assertTrue
(
$result
[
1
]
instanceof
DDC512Customer
);
if
(
$result
[
0
]
->
id
==
$customer1
->
id
)
{
$this
->
assertTrue
(
$result
[
0
]
->
item
instanceof
DDC512OfferItem
);
$this
->
assertEquals
(
$item
->
id
,
$result
[
0
]
->
item
->
id
);
$this
->
assertNull
(
$result
[
1
]
->
item
);
}
else
{
$this
->
assertTrue
(
$result
[
1
]
->
item
instanceof
DDC512OfferItem
);
$this
->
assertNull
(
$result
[
0
]
->
item
);
}
}
}
/**
* @Entity
*/
class
DDC512Customer
{
/**
* @Id
* @Column(type="integer")
* @GeneratedValue(strategy="AUTO")
*/
public
$id
;
/**
* NOTE that we can currently not name the join column the same as the field
* (item = item), this currently confuses Doctrine.
*
* @OneToOne(targetEntity="DDC512OfferItem", cascade={"remove","persist"})
* @JoinColumn(name="item_id", referencedColumnName="id")
*/
public
$item
;
}
/**
* @Entity
*/
class
DDC512OfferItem
extends
DDC512Item
{
}
/**
* @Entity
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorMap({"item" = "DDC512Item", "offerItem" = "DDC512OfferItem"})
*/
class
DDC512Item
{
/**
* @Id
* @Column(type="integer")
* @GeneratedValue(strategy="AUTO")
*/
public
$id
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment