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
7cc56c45
Commit
7cc56c45
authored
Apr 10, 2010
by
Roman S. Borschel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DDC-193] Fixed.
parent
5381e3d5
Changes
59
Show whitespace changes
Inline
Side-by-side
Showing
59 changed files
with
159 additions
and
211 deletions
+159
-211
UPGRADE_TO_2_0
UPGRADE_TO_2_0
+1
-1
doctrine-mapping.xsd
doctrine-mapping.xsd
+6
-3
EventArgs.php
lib/Doctrine/Common/EventArgs.php
+1
-1
EventSubscriber.php
lib/Doctrine/Common/EventSubscriber.php
+3
-4
ObjectHydrator.php
lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php
+5
-4
ClassMetadata.php
lib/Doctrine/ORM/Mapping/ClassMetadata.php
+0
-1
ClassMetadataInfo.php
lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
+3
-55
AbstractFileDriver.php
lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php
+6
-6
AnnotationDriver.php
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
+2
-2
DatabaseDriver.php
lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
+2
-2
DoctrineAnnotations.php
lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php
+0
-2
DriverChain.php
lib/Doctrine/ORM/Mapping/Driver/DriverChain.php
+3
-3
PhpDriver.php
lib/Doctrine/ORM/Mapping/Driver/PhpDriver.php
+0
-1
XmlDriver.php
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
+20
-9
YamlDriver.php
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
+13
-1
ManyToManyMapping.php
lib/Doctrine/ORM/Mapping/ManyToManyMapping.php
+6
-6
OneToOneMapping.php
lib/Doctrine/ORM/Mapping/OneToOneMapping.php
+5
-9
PersistentCollection.php
lib/Doctrine/ORM/PersistentCollection.php
+3
-14
AbstractCollectionPersister.php
lib/Doctrine/ORM/Persisters/AbstractCollectionPersister.php
+1
-1
StandardEntityPersister.php
lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
+2
-2
UnitOfWork.php
lib/Doctrine/ORM/UnitOfWork.php
+4
-4
CmsAddress.php
tests/Doctrine/Tests/Models/CMS/CmsAddress.php
+5
-7
CmsArticle.php
tests/Doctrine/Tests/Models/CMS/CmsArticle.php
+1
-1
CmsComment.php
tests/Doctrine/Tests/Models/CMS/CmsComment.php
+1
-1
CmsEmployee.php
tests/Doctrine/Tests/Models/CMS/CmsEmployee.php
+2
-2
CmsGroup.php
tests/Doctrine/Tests/Models/CMS/CmsGroup.php
+2
-2
CmsPhonenumber.php
tests/Doctrine/Tests/Models/CMS/CmsPhonenumber.php
+2
-2
CmsUser.php
tests/Doctrine/Tests/Models/CMS/CmsUser.php
+1
-1
CompanyEvent.php
tests/Doctrine/Tests/Models/Company/CompanyEvent.php
+2
-2
CompanyPerson.php
tests/Doctrine/Tests/Models/Company/CompanyPerson.php
+2
-2
CompanyRaffle.php
tests/Doctrine/Tests/Models/Company/CompanyRaffle.php
+1
-1
ECommerceCart.php
tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php
+3
-3
ECommerceCategory.php
tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php
+1
-1
ECommerceFeature.php
tests/Doctrine/Tests/Models/ECommerce/ECommerceFeature.php
+3
-3
ECommerceProduct.php
tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php
+5
-5
ECommerceShipping.php
tests/Doctrine/Tests/Models/ECommerce/ECommerceShipping.php
+1
-1
ForumBoard.php
tests/Doctrine/Tests/Models/Forum/ForumBoard.php
+1
-1
ForumUser.php
tests/Doctrine/Tests/Models/Forum/ForumUser.php
+1
-2
DateTimeModel.php
tests/Doctrine/Tests/Models/Generic/DateTimeModel.php
+1
-1
RoutingLeg.php
tests/Doctrine/Tests/Models/Routing/RoutingLeg.php
+3
-4
RoutingLocation.php
tests/Doctrine/Tests/Models/Routing/RoutingLocation.php
+1
-2
RoutingRoute.php
tests/Doctrine/Tests/Models/Routing/RoutingRoute.php
+1
-1
RoutingRouteBooking.php
tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php
+2
-2
DDC144Test.php
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php
+4
-4
DDC199Test.php
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php
+4
-4
DDC211Test.php
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php
+1
-1
DDC237Test.php
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php
+3
-3
DDC279Test.php
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php
+3
-5
DDC309Test.php
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC309Test.php
+2
-2
DDC345Test.php
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php
+2
-2
DDC353Test.php
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC353Test.php
+1
-2
DDC371Test.php
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php
+1
-1
DDC381Test.php
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php
+1
-1
Ticket69.php
tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php
+2
-2
AbstractMappingDriverTest.php
.../Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
+2
-3
ClassMetadataTest.php
tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php
+2
-2
Doctrine.Tests.ORM.Mapping.User.php
...Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php
+1
-0
Doctrine.Tests.ORM.Mapping.User.dcm.xml
...s/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml
+1
-1
Doctrine.Tests.ORM.Mapping.User.dcm.yml
.../ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml
+1
-0
No files found.
UPGRADE_TO_2_0
View file @
7cc56c45
...
...
@@ -46,7 +46,7 @@ Prefer PHP default values, if possible.
## Partial Objects
xxx
[TBD: New syntax, results, etc.]
## XML Mapping Driver
...
...
doctrine-mapping.xsd
View file @
7cc56c45
...
...
@@ -217,7 +217,7 @@
</xs:complexType>
<xs:complexType
name=
"order-by-field"
>
<xs:attribute
name=
"
field"
type=
"XS
:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"
name"
type=
"xs
:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"direction"
type=
"orm:order-by-direction"
default=
"ASC"
/>
</xs:complexType>
...
...
@@ -237,6 +237,7 @@
<xs:attribute
name=
"target-entity"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"field"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"mapped-by"
type=
"xs:NMTOKEN"
/>
<xs:attribute
name=
"inversed-by"
type=
"xs:NMTOKEN"
/>
<xs:attribute
name=
"fetch"
type=
"orm:fetch-type"
default=
"LAZY"
/>
</xs:complexType>
...
...
@@ -246,7 +247,7 @@
<xs:element
name=
"order-by"
type=
"orm:order-by"
minOccurs=
"0"
/>
</xs:sequence>
<xs:attribute
name=
"target-entity"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"mapped-by"
type=
"xs:NMTOKEN"
/>
<xs:attribute
name=
"mapped-by"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"field"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"orphan-removal"
type=
"xs:boolean"
default=
"false"
/>
<xs:attribute
name=
"fetch"
type=
"orm:fetch-type"
default=
"LAZY"
/>
...
...
@@ -264,6 +265,7 @@
<xs:attribute
name=
"field"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"orphan-removal"
type=
"xs:boolean"
default=
"false"
/>
<xs:attribute
name=
"fetch"
type=
"orm:fetch-type"
default=
"LAZY"
/>
<xs:attribute
name=
"inversed-by"
type=
"xs:NMTOKEN"
/>
</xs:complexType>
<xs:complexType
name=
"one-to-one"
>
...
...
@@ -274,9 +276,10 @@
<xs:element
name=
"join-columns"
type=
"orm:join-columns"
/>
</xs:choice>
</xs:sequence>
<xs:attribute
name=
"field"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"target-entity"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"mapped-by"
type=
"xs:NMTOKEN"
/>
<xs:attribute
name=
"
field"
type=
"xs:NMTOKEN"
use=
"required
"
/>
<xs:attribute
name=
"
inversed-by"
type=
"xs:NMTOKEN
"
/>
<xs:attribute
name=
"orphan-removal"
type=
"xs:boolean"
default=
"false"
/>
<xs:attribute
name=
"fetch"
type=
"orm:fetch-type"
default=
"LAZY"
/>
</xs:complexType>
...
...
lib/Doctrine/Common/EventArgs.php
View file @
7cc56c45
...
...
@@ -26,7 +26,7 @@ namespace Doctrine\Common;
*
* This class contains no event data. It is used by events that do not pass state
* information to an event handler when an event is raised. The single empty EventArgs
* instance can be obtained through {@link getEmptyInstance
()
}.
* instance can be obtained through {@link getEmptyInstance}.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
...
...
lib/Doctrine/Common/EventSubscriber.php
View file @
7cc56c45
...
...
@@ -16,7 +16,7 @@
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.
phpdoctrine
.org>.
* <http://www.
doctrine-project
.org>.
*/
namespace
Doctrine\Common
;
...
...
@@ -24,13 +24,12 @@ namespace Doctrine\Common;
/**
* An EventSubscriber knows himself what events he is interested in.
* If an EventSubscriber is added to an EventManager, the manager invokes
*
getSubscribedEvents()
and registers the subscriber as a listener for all
*
{@link getSubscribedEvents}
and registers the subscriber as a listener for all
* returned events.
*
* @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>
...
...
@@ -38,7 +37,7 @@ namespace Doctrine\Common;
interface
EventSubscriber
{
/**
* Returns an array of events th
at this subscriber listens
* Returns an array of events th
is subscriber wants to listen to.
*
* @return array
*/
...
...
lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php
View file @
7cc56c45
...
...
@@ -87,8 +87,8 @@ class ObjectHydrator extends AbstractHydrator
if
(
$assoc
->
mappedBy
)
{
$this
->
_hints
[
'fetched'
][
$className
][
$assoc
->
mappedBy
]
=
true
;
}
else
{
if
(
isset
(
$class
->
inverseMappings
[
$sourceClassName
][
$assoc
->
sourceFieldName
])
)
{
$inverseAssoc
=
$class
->
inverseMappings
[
$sourceClassName
][
$assoc
->
sourceFieldName
];
if
(
$assoc
->
inversedBy
)
{
$inverseAssoc
=
$class
->
associationMappings
[
$assoc
->
inversedBy
];
if
(
$inverseAssoc
->
isOneToOne
())
{
$this
->
_hints
[
'fetched'
][
$className
][
$inverseAssoc
->
sourceFieldName
]
=
true
;
if
(
$class
->
subClasses
)
{
...
...
@@ -346,9 +346,10 @@ class ObjectHydrator extends AbstractHydrator
$this
->
_uow
->
setOriginalEntityProperty
(
$oid
,
$relationField
,
$element
);
$targetClass
=
$this
->
_ce
[
$relation
->
targetEntityName
];
if
(
$relation
->
isOwningSide
)
{
//TODO: Just check hints['fetched'] here?
// If there is an inverse mapping on the target class its bidirectional
if
(
isset
(
$targetClass
->
inverseMappings
[
$relation
->
sourceEntityName
][
$relationField
])
)
{
$inverseAssoc
=
$targetClass
->
inverseMappings
[
$relation
->
sourceEntityName
][
$relationField
];
if
(
$relation
->
inversedBy
)
{
$inverseAssoc
=
$targetClass
->
associationMappings
[
$relation
->
inversedBy
];
if
(
$inverseAssoc
->
isOneToOne
())
{
$targetClass
->
reflFields
[
$inverseAssoc
->
sourceFieldName
]
->
setValue
(
$element
,
$parentObject
);
$this
->
_uow
->
setOriginalEntityProperty
(
spl_object_hash
(
$element
),
$inverseAssoc
->
sourceFieldName
,
$parentObject
);
...
...
lib/Doctrine/ORM/Mapping/ClassMetadata.php
View file @
7cc56c45
...
...
@@ -315,7 +315,6 @@ class ClassMetadata extends ClassMetadataInfo
'idGenerator'
,
//TODO: Does not really need to be serialized. Could be moved to runtime.
'inheritanceType'
,
'inheritedAssociationFields'
,
'inverseMappings'
,
//TODO: Remove! DDC-193
'isIdentifierComposite'
,
'isMappedSuperclass'
,
'isVersioned'
,
...
...
lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
View file @
7cc56c45
...
...
@@ -127,9 +127,9 @@ class ClassMetadataInfo
public
$namespace
;
/**
* READ-ONLY: The name of the entity class that is at the root of the entity inheritance
* hierarchy. If the entity is not part of a
n
inheritance hierarchy this is the same
* as
$_entityName
.
* READ-ONLY: The name of the entity class that is at the root of the
mapped
entity inheritance
* hierarchy. If the entity is not part of a
mapped
inheritance hierarchy this is the same
* as
{@link $entityName}
.
*
* @var string
*/
...
...
@@ -312,14 +312,6 @@ class ClassMetadataInfo
*/
public
$associationMappings
=
array
();
/**
* READ-ONLY: List of inverse association mappings, indexed by mappedBy field name.
*
* @var array
* @todo Remove! See http://www.doctrine-project.org/jira/browse/DDC-193
*/
public
$inverseMappings
=
array
();
/**
* READ-ONLY: Flag indicating whether the identifier/primary key of the class is composite.
*
...
...
@@ -531,34 +523,6 @@ class ClassMetadataInfo
return
$this
->
associationMappings
[
$fieldName
];
}
/**
* Gets the inverse association mapping for the given target class name and
* owning fieldname.
*
* @param string $mappedByFieldName The field on the
* @return Doctrine\ORM\Mapping\AssociationMapping The mapping or NULL if there is no such
* inverse association mapping.
*/
public
function
getInverseAssociationMapping
(
$targetClassName
,
$mappedByFieldName
)
{
return
isset
(
$this
->
inverseMappings
[
$targetClassName
][
$mappedByFieldName
])
?
$this
->
inverseMappings
[
$targetClassName
][
$mappedByFieldName
]
:
null
;
}
/**
* Checks whether the class has an inverse association mapping that points to the
* specified class and ha the specified mappedBy field.
*
* @param string $targetClassName The name of the target class.
* @param string $mappedByFieldName The name of the mappedBy field that points to the field on
* the target class that owns the association.
* @return boolean
*/
public
function
hasInverseAssociationMapping
(
$targetClassName
,
$mappedByFieldName
)
{
return
isset
(
$this
->
inverseMappings
[
$targetClassName
][
$mappedByFieldName
]);
}
/**
* Gets all association mappings of the class.
*
...
...
@@ -1063,7 +1027,6 @@ class ClassMetadataInfo
if
(
$owningClassName
!==
null
)
{
$this
->
inheritedAssociationFields
[
$sourceFieldName
]
=
$owningClassName
;
}
$this
->
_registerMappingIfInverse
(
$mapping
);
}
/**
...
...
@@ -1093,20 +1056,6 @@ class ClassMetadataInfo
$this
->
_storeAssociationMapping
(
$oneToOneMapping
);
}
/**
* Registers the mapping as an inverse mapping, if it is a mapping on the
* inverse side of an association mapping.
*
* @param AssociationMapping The mapping to register as inverse if it is a mapping
* for the inverse side of an association.
*/
private
function
_registerMappingIfInverse
(
AssociationMapping
$assoc
)
{
if
(
!
$assoc
->
isOwningSide
)
{
$this
->
inverseMappings
[
$assoc
->
targetEntityName
][
$assoc
->
mappedBy
]
=
$assoc
;
}
}
/**
* Adds a one-to-many mapping.
*
...
...
@@ -1154,7 +1103,6 @@ class ClassMetadataInfo
throw
MappingException
::
duplicateFieldMapping
(
$this
->
name
,
$sourceFieldName
);
}
$this
->
associationMappings
[
$sourceFieldName
]
=
$assocMapping
;
$this
->
_registerMappingIfInverse
(
$assocMapping
);
}
/**
...
...
lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php
View file @
7cc56c45
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
View file @
7cc56c45
...
...
@@ -173,7 +173,7 @@ class AnnotationDriver implements Driver
// Evaluate InheritanceType annotation
if
(
isset
(
$classAnnotations
[
'Doctrine\ORM\Mapping\InheritanceType'
]))
{
$inheritanceTypeAnnot
=
$classAnnotations
[
'Doctrine\ORM\Mapping\InheritanceType'
];
$metadata
->
setInheritanceType
(
constant
(
'
\
Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_'
.
$inheritanceTypeAnnot
->
value
));
$metadata
->
setInheritanceType
(
constant
(
'Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_'
.
$inheritanceTypeAnnot
->
value
));
}
// Evaluate DiscriminatorColumn annotation
...
...
@@ -195,7 +195,7 @@ class AnnotationDriver implements Driver
// Evaluate DoctrineChangeTrackingPolicy annotation
if
(
isset
(
$classAnnotations
[
'Doctrine\ORM\Mapping\ChangeTrackingPolicy'
]))
{
$changeTrackingAnnot
=
$classAnnotations
[
'Doctrine\ORM\Mapping\ChangeTrackingPolicy'
];
$metadata
->
setChangeTrackingPolicy
(
constant
(
'
\
Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_'
.
$changeTrackingAnnot
->
value
));
$metadata
->
setChangeTrackingPolicy
(
constant
(
'Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_'
.
$changeTrackingAnnot
->
value
));
}
// Evaluate annotations on properties/fields
...
...
lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
View file @
7cc56c45
...
...
@@ -29,7 +29,7 @@ use Doctrine\Common\Cache\ArrayCache,
Doctrine\Common\Util\Inflector
;
/**
* The DatabaseDriver reverse engineers the mapping metadata from a database
* The DatabaseDriver reverse engineers the mapping metadata from a database
.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
...
...
@@ -67,7 +67,7 @@ class DatabaseDriver implements Driver
$columns
=
$this
->
_sm
->
listTableColumns
(
$tableName
);
if
(
$this
->
_sm
->
getDatabasePlatform
()
->
supportsForeignKeyConstraints
())
{
if
(
$this
->
_sm
->
getDatabasePlatform
()
->
supportsForeignKeyConstraints
())
{
$foreignKeys
=
$this
->
_sm
->
listTableForeignKeys
(
$tableName
);
}
else
{
$foreignKeys
=
array
();
...
...
lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php
View file @
7cc56c45
...
...
@@ -37,7 +37,6 @@ final class DiscriminatorColumn extends Annotation {
public
$length
;
}
final
class
DiscriminatorMap
extends
Annotation
{}
/*final class SubClasses extends Annotation {}*/
final
class
Id
extends
Annotation
{}
final
class
GeneratedValue
extends
Annotation
{
public
$strategy
=
'AUTO'
;
...
...
@@ -124,7 +123,6 @@ final class SequenceGenerator extends Annotation {
public
$initialValue
=
1
;
}
final
class
ChangeTrackingPolicy
extends
Annotation
{}
final
class
OrderBy
extends
Annotation
{}
/* Annotations for lifecycle callbacks */
...
...
lib/Doctrine/ORM/Mapping/Driver/DriverChain.php
View file @
7cc56c45
...
...
@@ -46,7 +46,7 @@ class DriverChain implements Driver
private
$_drivers
=
array
();
/**
* Add a nested driver
* Add a nested driver
.
*
* @param Driver $nestedDriver
* @param string $namespace
...
...
@@ -57,7 +57,7 @@ class DriverChain implements Driver
}
/**
* Get the array of nested drivers
* Get the array of nested drivers
.
*
* @return array $drivers
*/
...
...
@@ -74,7 +74,7 @@ class DriverChain implements Driver
*/
public
function
loadMetadataForClass
(
$className
,
ClassMetadataInfo
$metadata
)
{
foreach
(
$this
->
_drivers
AS
$namespace
=>
$driver
)
{
foreach
(
$this
->
_drivers
as
$namespace
=>
$driver
)
{
if
(
strpos
(
$className
,
$namespace
)
===
0
)
{
$driver
->
loadMetadataForClass
(
$className
,
$metadata
);
return
;
...
...
lib/Doctrine/ORM/Mapping/Driver/PhpDriver.php
View file @
7cc56c45
...
...
@@ -49,7 +49,6 @@ class PhpDriver extends AbstractFileDriver
* {@inheritdoc}
*/
protected
$_fileExtension
=
'.php'
;
protected
$_metadata
;
/**
...
...
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
View file @
7cc56c45
...
...
@@ -21,7 +21,8 @@
namespace
Doctrine\ORM\Mapping\Driver
;
use
Doctrine\ORM\Mapping\ClassMetadataInfo
,
use
SimpleXMLElement
,
Doctrine\ORM\Mapping\ClassMetadataInfo
,
Doctrine\ORM\Mapping\MappingException
;
/**
...
...
@@ -226,6 +227,9 @@ class XmlDriver extends AbstractFileDriver
if
(
isset
(
$oneToOneElement
[
'mapped-by'
]))
{
$mapping
[
'mappedBy'
]
=
(
string
)
$oneToOneElement
[
'mapped-by'
];
}
else
{
if
(
isset
(
$oneToOneElement
[
'inversed-by'
]))
{
$mapping
[
'inversedBy'
]
=
(
string
)
$oneToOneElement
[
'inversed-by'
];
}
$joinColumns
=
array
();
if
(
isset
(
$oneToOneElement
->
{
'join-column'
}))
{
...
...
@@ -296,6 +300,10 @@ class XmlDriver extends AbstractFileDriver
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
(
string
)
$manyToOneElement
[
'fetch'
]);
}
if
(
isset
(
$manyToOneElement
[
'inversed-by'
]))
{
$mapping
[
'inversedBy'
]
=
(
string
)
$manyToOneElement
[
'inversed-by'
];
}
$joinColumns
=
array
();
if
(
isset
(
$manyToOneElement
->
{
'join-column'
}))
{
...
...
@@ -305,7 +313,6 @@ class XmlDriver extends AbstractFileDriver
if
(
!
isset
(
$joinColumnElement
[
'name'
]))
{
$joinColumnElement
[
'name'
]
=
$name
;
}
$joinColumns
[]
=
$this
->
_getJoinColumnMapping
(
$joinColumnElement
);
}
}
...
...
@@ -339,6 +346,10 @@ class XmlDriver extends AbstractFileDriver
if
(
isset
(
$manyToManyElement
[
'mapped-by'
]))
{
$mapping
[
'mappedBy'
]
=
(
string
)
$manyToManyElement
[
'mapped-by'
];
}
else
if
(
isset
(
$manyToManyElement
->
{
'join-table'
}))
{
if
(
isset
(
$manyToManyElement
[
'inversed-by'
]))
{
$mapping
[
'inversedBy'
]
=
(
string
)
$manyToManyElement
[
'inversed-by'
];
}
$joinTableElement
=
$manyToManyElement
->
{
'join-table'
};
$joinTable
=
array
(
'name'
=>
(
string
)
$joinTableElement
[
'name'
]
...
...
@@ -382,7 +393,7 @@ class XmlDriver extends AbstractFileDriver
// Evaluate <lifecycle-callbacks...>
if
(
isset
(
$xmlRoot
->
{
'lifecycle-callbacks'
}))
{
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'
]));
}
}
}
...
...
@@ -394,7 +405,7 @@ class XmlDriver extends AbstractFileDriver
* @param $joinColumnElement The XML element.
* @return array The mapping array.
*/
private
function
_getJoinColumnMapping
(
\
SimpleXMLElement
$joinColumnElement
)
private
function
_getJoinColumnMapping
(
SimpleXMLElement
$joinColumnElement
)
{
$joinColumn
=
array
(
'name'
=>
(
string
)
$joinColumnElement
[
'name'
],
...
...
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
View file @
7cc56c45
...
...
@@ -230,6 +230,10 @@ class YamlDriver extends AbstractFileDriver
if
(
isset
(
$oneToOneElement
[
'mappedBy'
]))
{
$mapping
[
'mappedBy'
]
=
$oneToOneElement
[
'mappedBy'
];
}
else
{
if
(
isset
(
$oneToOneElement
[
'inversedBy'
]))
{
$mapping
[
'inversedBy'
]
=
$oneToOneElement
[
'inversedBy'
];
}
$joinColumns
=
array
();
if
(
isset
(
$oneToOneElement
[
'joinColumn'
]))
{
...
...
@@ -292,6 +296,10 @@ class YamlDriver extends AbstractFileDriver
$mapping
[
'fetch'
]
=
constant
(
'Doctrine\ORM\Mapping\AssociationMapping::FETCH_'
.
$manyToOneElement
[
'fetch'
]);
}
if
(
isset
(
$manyToOneElement
[
'inversedBy'
]))
{
$mapping
[
'inversedBy'
]
=
$manyToOneElement
[
'inversedBy'
];
}
$joinColumns
=
array
();
if
(
isset
(
$manyToOneElement
[
'joinColumn'
]))
{
...
...
@@ -331,6 +339,10 @@ class YamlDriver extends AbstractFileDriver
if
(
isset
(
$manyToManyElement
[
'mappedBy'
]))
{
$mapping
[
'mappedBy'
]
=
$manyToManyElement
[
'mappedBy'
];
}
else
if
(
isset
(
$manyToManyElement
[
'joinTable'
]))
{
if
(
isset
(
$manyToManyElement
[
'inversedBy'
]))
{
$mapping
[
'inversedBy'
]
=
$manyToManyElement
[
'inversedBy'
];
}
$joinTableElement
=
$manyToManyElement
[
'joinTable'
];
$joinTable
=
array
(
'name'
=>
$joinTableElement
[
'name'
]
...
...
@@ -375,7 +387,7 @@ class YamlDriver extends AbstractFileDriver
if
(
isset
(
$element
[
'lifecycleCallbacks'
]))
{
foreach
(
$element
[
'lifecycleCallbacks'
]
as
$type
=>
$methods
)
{
foreach
(
$methods
as
$method
)
{
$metadata
->
addLifecycleCallback
(
$method
,
constant
(
'
\
Doctrine\ORM\Events::'
.
$type
));
$metadata
->
addLifecycleCallback
(
$method
,
constant
(
'Doctrine\ORM\Events::'
.
$type
));
}
}
}
...
...
lib/Doctrine/ORM/Mapping/ManyToManyMapping.php
View file @
7cc56c45
...
...
@@ -70,10 +70,7 @@ class ManyToManyMapping extends AssociationMapping
public
$orderBy
;
/**
* Validates and completes the mapping.
*
* @param array $mapping
* @override
* {@inheritdoc}
*/
protected
function
_validateAndCompleteMapping
(
array
$mapping
)
{
...
...
@@ -89,13 +86,15 @@ class ManyToManyMapping extends AssociationMapping
'joinColumns'
=>
array
(
array
(
'name'
=>
$sourceShortName
.
'_id'
,
'referencedColumnName'
=>
'id'
'referencedColumnName'
=>
'id'
,
'onDelete'
=>
'CASCADE'
)
),
'inverseJoinColumns'
=>
array
(
array
(
'name'
=>
$targetShortName
.
'_id'
,
'referencedColumnName'
=>
'id'
'referencedColumnName'
=>
'id'
,
'onDelete'
=>
'CASCADE'
)
)
);
...
...
@@ -178,6 +177,7 @@ class ManyToManyMapping extends AssociationMapping
$persister
->
loadManyToManyCollection
(
$this
,
$joinTableConditions
,
$targetCollection
);
}
/** {@inheritdoc} */
public
function
isManyToMany
()
{
return
true
;
...
...
lib/Doctrine/ORM/Mapping/OneToOneMapping.php
View file @
7cc56c45
...
...
@@ -141,18 +141,14 @@ class OneToOneMapping extends AssociationMapping
$targetClass
=
$em
->
getClassMetadata
(
$this
->
targetEntityName
);
if
(
$this
->
isOwningSide
)
{
$inverseField
=
isset
(
$targetClass
->
inverseMappings
[
$this
->
sourceEntityName
][
$this
->
sourceFieldName
])
?
$targetClass
->
inverseMappings
[
$this
->
sourceEntityName
][
$this
->
sourceFieldName
]
->
sourceFieldName
:
false
;
// Mark inverse side as fetched in the hints, otherwise the UoW would
// try to load it in a separate query (remember: to-one inverse sides can not be lazy).
$hints
=
array
();
if
(
$
inverseField
)
{
$hints
[
'fetched'
][
$targetClass
->
name
][
$
inverseField
]
=
true
;
if
(
$
this
->
inversedBy
)
{
$hints
[
'fetched'
][
$targetClass
->
name
][
$
this
->
inversedBy
]
=
true
;
if
(
$targetClass
->
subClasses
)
{
foreach
(
$targetClass
->
subClasses
as
$targetSubclassName
)
{
$hints
[
'fetched'
][
$targetSubclassName
][
$
inverseField
]
=
true
;
$hints
[
'fetched'
][
$targetSubclassName
][
$
this
->
inversedBy
]
=
true
;
}
}
}
...
...
@@ -164,8 +160,8 @@ class OneToOneMapping extends AssociationMapping
$targetEntity
=
$em
->
getUnitOfWork
()
->
getEntityPersister
(
$this
->
targetEntityName
)
->
load
(
$joinColumnValues
,
$targetEntity
,
$this
,
$hints
);
if
(
$targetEntity
!==
null
&&
$
inverseField
&&
!
$targetClass
->
isCollectionValuedAssociation
(
$inverseField
))
{
$targetClass
->
reflFields
[
$
inverseField
]
->
setValue
(
$targetEntity
,
$sourceEntity
);
if
(
$targetEntity
!==
null
&&
$
this
->
inversedBy
&&
!
$targetClass
->
isCollectionValuedAssociation
(
$this
->
inversedBy
))
{
$targetClass
->
reflFields
[
$
this
->
inversedBy
]
->
setValue
(
$targetEntity
,
$sourceEntity
);
}
}
else
{
$conditions
=
array
();
...
...
lib/Doctrine/ORM/PersistentCollection.php
View file @
7cc56c45
...
...
@@ -134,18 +134,7 @@ final class PersistentCollection implements Collection
{
$this
->
_owner
=
$entity
;
$this
->
_association
=
$assoc
;
// Check for bidirectionality
//$this->_backRefFieldName = $assoc->inversedBy ?: $assoc->mappedBy;
if
(
!
$assoc
->
isOwningSide
)
{
// For sure bi-directional
$this
->
_backRefFieldName
=
$assoc
->
mappedBy
;
}
else
{
if
(
isset
(
$this
->
_typeClass
->
inverseMappings
[
$assoc
->
sourceEntityName
][
$assoc
->
sourceFieldName
]))
{
// Bi-directional
$this
->
_backRefFieldName
=
$this
->
_typeClass
->
inverseMappings
[
$assoc
->
sourceEntityName
][
$assoc
->
sourceFieldName
]
->
sourceFieldName
;
}
}
$this
->
_backRefFieldName
=
$assoc
->
inversedBy
?:
$assoc
->
mappedBy
;
}
/**
...
...
@@ -174,8 +163,8 @@ final class PersistentCollection implements Collection
public
function
hydrateAdd
(
$element
)
{
$this
->
_coll
->
add
(
$element
);
// If _backRefFieldName is set
, then the association is bidirectional
//
and
we need to set the back reference.
// If _backRefFieldName is set
and its a one-to-many association,
// we need to set the back reference.
if
(
$this
->
_backRefFieldName
&&
$this
->
_association
->
isOneToMany
())
{
// Set back reference to owner
$this
->
_typeClass
->
reflFields
[
$this
->
_backRefFieldName
]
...
...
lib/Doctrine/ORM/Persisters/AbstractCollectionPersister.php
View file @
7cc56c45
...
...
@@ -50,7 +50,7 @@ abstract class AbstractCollectionPersister
protected
$_uow
;
/**
* Initializes a new instance of a class derived from
{@link AbstractCollectionPersister}
.
* Initializes a new instance of a class derived from
AbstractCollectionPersister
.
*
* @param Doctrine\ORM\EntityManager $em
*/
...
...
lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
View file @
7cc56c45
...
...
@@ -492,8 +492,8 @@ class StandardEntityPersister
if
(
$found
=
$this
->
_em
->
getUnitOfWork
()
->
tryGetById
(
$joinColumnValues
,
$targetClass
->
rootEntityName
))
{
$this
->
_class
->
reflFields
[
$field
]
->
setValue
(
$entity
,
$found
);
// Complete inverse side, if necessary.
if
(
isset
(
$targetClass
->
inverseMappings
[
$this
->
_class
->
name
][
$field
])
)
{
$inverseAssoc
=
$targetClass
->
inverseMappings
[
$this
->
_class
->
name
][
$field
];
if
(
$assoc
->
inversedBy
)
{
$inverseAssoc
=
$targetClass
->
associationMappings
[
$assoc
->
inversedBy
];
$targetClass
->
reflFields
[
$inverseAssoc
->
sourceFieldName
]
->
setValue
(
$found
,
$entity
);
}
$newData
[
$field
]
=
$found
;
...
...
lib/Doctrine/ORM/UnitOfWork.php
View file @
7cc56c45
...
...
@@ -1359,7 +1359,7 @@ class UnitOfWork implements PropertyChangedListener
$assoc2
=
$class
->
associationMappings
[
$name
];
if
(
$assoc2
->
isOneToOne
())
{
if
(
!
$assoc2
->
isCascadeMerge
)
{
$other
=
$class
->
reflFields
[
$name
]
->
getValue
(
$entity
);
$other
=
$class
->
reflFields
[
$name
]
->
getValue
(
$entity
);
//TODO: Just $prop->getValue($entity)?
if
(
$other
!==
null
)
{
$targetClass
=
$this
->
_em
->
getClassMetadata
(
$assoc2
->
targetEntityName
);
$id
=
$targetClass
->
getIdentifierValues
(
$other
);
...
...
tests/Doctrine/Tests/Models/CMS/CmsAddress.php
View file @
7cc56c45
...
...
@@ -13,23 +13,22 @@ class CmsAddress
{
/**
* @Column(type="integer")
* @Id
* @GeneratedValue(strategy="AUTO")
* @Id @GeneratedValue
*/
public
$id
;
/**
* @Column(
type="string",
length=50)
* @Column(length=50)
*/
public
$country
;
/**
* @Column(
type="string",
length=50)
* @Column(length=50)
*/
public
$zip
;
/**
* @Column(
type="string",
length=50)
* @Column(length=50)
*/
public
$city
;
...
...
@@ -39,8 +38,7 @@ class CmsAddress
public
$street
;
/**
* @OneToOne(targetEntity="CmsUser")
// * @JoinColumn(name="user_id", referencedColumnName="id")
* @OneToOne(targetEntity="CmsUser", inversedBy="address")
*/
public
$user
;
...
...
tests/Doctrine/Tests/Models/CMS/CmsArticle.php
View file @
7cc56c45
...
...
@@ -23,7 +23,7 @@ class CmsArticle
*/
public
$text
;
/**
* @ManyToOne(targetEntity="CmsUser")
* @ManyToOne(targetEntity="CmsUser"
, inversedBy="articles"
)
* @JoinColumn(name="user_id", referencedColumnName="id")
*/
public
$user
;
...
...
tests/Doctrine/Tests/Models/CMS/CmsComment.php
View file @
7cc56c45
...
...
@@ -23,7 +23,7 @@ class CmsComment
*/
public
$text
;
/**
* @ManyToOne(targetEntity="CmsArticle")
* @ManyToOne(targetEntity="CmsArticle"
, inversedBy="comments"
)
* @JoinColumn(name="article_id", referencedColumnName="id")
*/
public
$article
;
...
...
tests/Doctrine/Tests/Models/CMS/CmsEmployee.php
View file @
7cc56c45
...
...
@@ -14,12 +14,12 @@ class CmsEmployee
/**
* @Id
* @Column(type="integer")
* @GeneratedValue
(strategy="AUTO")
* @GeneratedValue
*/
private
$id
;
/**
* @Column
(type="string")
* @Column
*/
private
$name
;
...
...
tests/Doctrine/Tests/Models/CMS/CmsGroup.php
View file @
7cc56c45
...
...
@@ -18,11 +18,11 @@ class CmsGroup
/**
* @Id
* @Column(type="integer")
* @GeneratedValue
(strategy="AUTO")
* @GeneratedValue
*/
public
$id
;
/**
* @Column(
type="string",
length=50)
* @Column(length=50)
*/
public
$name
;
/**
...
...
tests/Doctrine/Tests/Models/CMS/CmsPhonenumber.php
View file @
7cc56c45
...
...
@@ -9,11 +9,11 @@ namespace Doctrine\Tests\Models\CMS;
class
CmsPhonenumber
{
/**
* @Id @Column(
type="string",
length=50)
* @Id @Column(length=50)
*/
public
$phonenumber
;
/**
* @ManyToOne(targetEntity="CmsUser")
* @ManyToOne(targetEntity="CmsUser"
, inversedBy="phonenumbers"
)
* @JoinColumn(name="user_id", referencedColumnName="id")
*/
public
$user
;
...
...
tests/Doctrine/Tests/Models/CMS/CmsUser.php
View file @
7cc56c45
...
...
@@ -40,7 +40,7 @@ class CmsUser
*/
public
$address
;
/**
* @ManyToMany(targetEntity="CmsGroup", cascade={"persist"})
* @ManyToMany(targetEntity="CmsGroup",
inversedBy="users",
cascade={"persist"})
* @JoinTable(name="cms_users_groups",
* joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="group_id", referencedColumnName="id")}
...
...
tests/Doctrine/Tests/Models/Company/CompanyEvent.php
View file @
7cc56c45
...
...
@@ -11,12 +11,12 @@ namespace Doctrine\Tests\Models\Company;
class
CompanyEvent
{
/**
* @Id @Column(type="integer")
* @GeneratedValue
(strategy="AUTO")
* @GeneratedValue
*/
private
$id
;
/**
* @ManyToOne(targetEntity="CompanyOrganization",cascade={"persist"})
* @ManyToOne(targetEntity="CompanyOrganization",
inversedBy="events",
cascade={"persist"})
* @JoinColumn(name="org_id", referencedColumnName="id")
*/
private
$organization
;
...
...
tests/Doctrine/Tests/Models/Company/CompanyPerson.php
View file @
7cc56c45
...
...
@@ -20,11 +20,11 @@ class CompanyPerson
/**
* @Id
* @Column(type="integer")
* @GeneratedValue
(strategy="AUTO")
* @GeneratedValue
*/
private
$id
;
/**
* @Column
(type="string")
* @Column
*/
private
$name
;
/**
...
...
tests/Doctrine/Tests/Models/Company/CompanyRaffle.php
View file @
7cc56c45
...
...
@@ -4,7 +4,7 @@ namespace Doctrine\Tests\Models\Company;
/** @Entity @Table(name="company_raffles") */
class
CompanyRaffle
extends
CompanyEvent
{
/** @Column
(type="string")
*/
/** @Column */
private
$data
;
public
function
setData
(
$data
)
{
...
...
tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php
View file @
7cc56c45
...
...
@@ -17,17 +17,17 @@ class ECommerceCart
/**
* @Column(type="integer")
* @Id
* @GeneratedValue
(strategy="AUTO")
* @GeneratedValue
*/
private
$id
;
/**
* @Column(
type="string",
length=50, nullable=true)
* @Column(length=50, nullable=true)
*/
private
$payment
;
/**
* @OneToOne(targetEntity="ECommerceCustomer")
* @OneToOne(targetEntity="ECommerceCustomer"
, inversedBy="cart"
)
* @JoinColumn(name="customer_id", referencedColumnName="id")
*/
private
$customer
;
...
...
tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php
View file @
7cc56c45
...
...
@@ -36,7 +36,7 @@ class ECommerceCategory
private
$children
;
/**
* @ManyToOne(targetEntity="ECommerceCategory")
* @ManyToOne(targetEntity="ECommerceCategory"
, inversedBy="children"
)
* @JoinColumn(name="parent_id", referencedColumnName="id")
*/
private
$parent
;
...
...
tests/Doctrine/Tests/Models/ECommerce/ECommerceFeature.php
View file @
7cc56c45
...
...
@@ -14,17 +14,17 @@ class ECommerceFeature
/**
* @Column(type="integer")
* @Id
* @GeneratedValue
(strategy="AUTO")
* @GeneratedValue
*/
private
$id
;
/**
* @Column(
type="string",
length=50)
* @Column(length=50)
*/
private
$description
;
/**
* @ManyToOne(targetEntity="ECommerceProduct")
* @ManyToOne(targetEntity="ECommerceProduct"
, inversedBy="features"
)
* @JoinColumn(name="product_id", referencedColumnName="id")
*/
private
$product
;
...
...
tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php
View file @
7cc56c45
...
...
@@ -10,14 +10,14 @@ use Doctrine\Common\Collections\ArrayCollection;
*
* @author Giorgio Sironi
* @Entity
* @Table(name="ecommerce_products",indexes={@
i
ndex(name="name_idx", columns={"name"})})
* @Table(name="ecommerce_products",indexes={@
I
ndex(name="name_idx", columns={"name"})})
*/
class
ECommerceProduct
{
/**
* @Column(type="integer")
* @Id
* @GeneratedValue
(strategy="AUTO")
* @GeneratedValue
*/
private
$id
;
...
...
@@ -38,7 +38,7 @@ class ECommerceProduct
private
$features
;
/**
* @ManyToMany(targetEntity="ECommerceCategory", cascade={"persist"})
* @ManyToMany(targetEntity="ECommerceCategory", cascade={"persist"}
, inversedBy="products"
)
* @JoinTable(name="ecommerce_products_categories",
* joinColumns={@JoinColumn(name="product_id", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="category_id", referencedColumnName="id")})
...
...
@@ -50,8 +50,8 @@ class ECommerceProduct
* simplicity.
* @ManyToMany(targetEntity="ECommerceProduct", cascade={"persist"})
* @JoinTable(name="ecommerce_products_related",
joinColumns={@JoinColumn(name="product_id", referencedColumnName="id")},
inverseJoinColumns={@JoinColumn(name="related_id", referencedColumnName="id")})
*
joinColumns={@JoinColumn(name="product_id", referencedColumnName="id")},
*
inverseJoinColumns={@JoinColumn(name="related_id", referencedColumnName="id")})
*/
private
$related
;
...
...
tests/Doctrine/Tests/Models/ECommerce/ECommerceShipping.php
View file @
7cc56c45
...
...
@@ -14,7 +14,7 @@ class ECommerceShipping
{
/**
* @Id @Column(type="integer")
* @GeneratedValue
(strategy="AUTO")
* @GeneratedValue
*/
private
$id
;
...
...
tests/Doctrine/Tests/Models/Forum/ForumBoard.php
View file @
7cc56c45
...
...
@@ -21,7 +21,7 @@ class ForumBoard
*/
public
$position
;
/**
* @ManyToOne(targetEntity="ForumCategory")
* @ManyToOne(targetEntity="ForumCategory"
, inversedBy="boards"
)
* @JoinColumn(name="category_id", referencedColumnName="id")
*/
public
$category
;
...
...
tests/Doctrine/Tests/Models/Forum/ForumUser.php
View file @
7cc56c45
...
...
@@ -10,8 +10,7 @@ class ForumUser
{
/**
* @Column(type="integer")
* @Id
* @GeneratedValue(strategy="AUTO")
* @Id @GeneratedValue
*/
public
$id
;
/**
...
...
tests/Doctrine/Tests/Models/Generic/DateTimeModel.php
View file @
7cc56c45
...
...
@@ -10,7 +10,7 @@ class DateTimeModel
{
/**
* @Id @Column(type="integer")
* @GeneratedValue
(strategy="AUTO")
* @GeneratedValue
*/
public
$id
;
/**
...
...
tests/Doctrine/Tests/Models/Routing/RoutingLeg.php
View file @
7cc56c45
...
...
@@ -8,20 +8,19 @@ namespace Doctrine\Tests\Models\Routing;
class
RoutingLeg
{
/**
* @Id
* @generatedValue(strategy="AUTO")
* @Id @generatedValue
* @column(type="integer")
*/
public
$id
;
/**
* @ManyToOne(targetEntity="
Doctrine\Tests\Models\Routing\
RoutingLocation")
* @ManyToOne(targetEntity="RoutingLocation")
* @JoinColumn(name="from_id", referencedColumnName="id")
*/
public
$fromLocation
;
/**
* @ManyToOne(targetEntity="
Doctrine\Tests\Models\Routing\
RoutingLocation")
* @ManyToOne(targetEntity="RoutingLocation")
* @JoinColumn(name="to_id", referencedColumnName="id")
*/
public
$toLocation
;
...
...
tests/Doctrine/Tests/Models/Routing/RoutingLocation.php
View file @
7cc56c45
...
...
@@ -8,8 +8,7 @@ namespace Doctrine\Tests\Models\Routing;
class
RoutingLocation
{
/**
* @Id
* @generatedValue(strategy="AUTO")
* @Id @GeneratedValue
* @Column(type="integer")
*/
public
$id
;
...
...
tests/Doctrine/Tests/Models/Routing/RoutingRoute.php
View file @
7cc56c45
...
...
@@ -11,7 +11,7 @@ class RoutingRoute
{
/**
* @Id
* @
generatedValue(strategy="AUTO")
* @
GeneratedValue
* @column(type="integer")
*/
public
$id
;
...
...
tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php
View file @
7cc56c45
...
...
@@ -10,12 +10,12 @@ class RoutingRouteBooking
/**
* @Id
* @Column(type="integer")
* @
generatedValue(strategy="AUTO")
* @
GeneratedValue
*/
public
$id
;
/**
* @ManyToOne(targetEntity="RoutingRoute")
* @ManyToOne(targetEntity="RoutingRoute"
, inversedBy="bookings"
)
* @JoinColumn(name="route_id", referencedColumnName="id")
*/
public
$route
;
...
...
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC144Test.php
View file @
7cc56c45
...
...
@@ -43,21 +43,21 @@ class DDC144Test extends \Doctrine\Tests\OrmFunctionalTestCase
*/
class
DDC144FlowElement
{
/**
* @Id @Column(type="integer") @GeneratedValue
(strategy="AUTO")
* @Id @Column(type="integer") @GeneratedValue
* @var integer
*/
public
$id
;
/** @Column
(type="string")
*/
/** @Column */
public
$property
;
}
// /** @Entity @Table(name="ddc144_expressions") */
abstract
class
DDC144Expression
extends
DDC144FlowElement
{
abstract
function
method
();
}
/** @Entity @Table(name="ddc144_operands") */
class
DDC144Operand
extends
DDC144Expression
{
/** @Column
(type="string")
*/
/** @Column */
public
$operandProperty
;
function
method
()
{}
}
...
...
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php
View file @
7cc56c45
...
...
@@ -79,7 +79,7 @@ class DDC199ParentClass
class
DDC199ChildClass
extends
DDC199ParentClass
{
/**
* @Column
(type="string")
* @Column
*/
public
$childData
;
}
...
...
@@ -87,13 +87,13 @@ class DDC199ChildClass extends DDC199ParentClass
/** @Entity @Table(name="ddc199_relatedclass") */
class
DDC199RelatedClass
{
/** @Id @Column(type="integer") @GeneratedValue
(strategy="AUTO")
*/
/** @Id @Column(type="integer") @GeneratedValue */
public
$id
;
/** @Column
(type="string")
*/
/** @Column */
public
$relatedData
;
/**
* @ManyToOne(targetEntity="DDC199ParentClass")
* @ManyToOne(targetEntity="DDC199ParentClass"
, inversedBy="relatedEntities"
)
* @JoinColumn(name="parent_id", referencedColumnName="id")
*/
public
$parent
;
...
...
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php
View file @
7cc56c45
...
...
@@ -65,7 +65,7 @@ class DDC211User
protected
$name
;
/**
* @ManyToMany(targetEntity="DDC211Group")
* @ManyToMany(targetEntity="DDC211Group"
, inversedBy="users"
)
* @JoinTable(name="user_groups",
* joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="group_id", referencedColumnName="id")}
...
...
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php
View file @
7cc56c45
...
...
@@ -68,7 +68,7 @@ class DDC237Test extends \Doctrine\Tests\OrmFunctionalTestCase
class
DDC237EntityX
{
/**
* @Id @Column(type="integer") @GeneratedValue
(strategy="AUTO")
* @Id @Column(type="integer") @GeneratedValue
*/
public
$id
;
/**
...
...
@@ -87,7 +87,7 @@ class DDC237EntityX
class
DDC237EntityY
{
/**
* @Id @Column(type="integer") @GeneratedValue
(strategy="AUTO")
* @Id @Column(type="integer") @GeneratedValue
*/
public
$id
;
/**
...
...
@@ -99,7 +99,7 @@ class DDC237EntityY
/** @Entity @Table(name="ddc237_z") */
class
DDC237EntityZ
{
/** @Id @Column(type="integer") @GeneratedValue
(strategy="AUTO")
*/
/** @Id @Column(type="integer") @GeneratedValue */
public
$id
;
/** @Column(type="string") */
public
$data
;
...
...
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php
View file @
7cc56c45
...
...
@@ -68,7 +68,7 @@ abstract class DDC279EntityXAbstract
{
/**
* @Id
* @
generatedValue(strategy="AUTO")
* @
GeneratedValue
* @Column(name="id", type="integer")
*/
public
$id
;
...
...
@@ -98,8 +98,7 @@ class DDC279EntityX extends DDC279EntityXAbstract
class
DDC279EntityY
{
/**
* @Id
* @generatedValue(strategy="AUTO")
* @Id @GeneratedValue
* @Column(name="id", type="integer")
*/
public
$id
;
...
...
@@ -122,8 +121,7 @@ class DDC279EntityY
class
DDC279EntityZ
{
/**
* @Id
* @generatedValue(strategy="AUTO")
* @Id @GeneratedValue
* @Column(name="id", type="integer")
*/
public
$id
;
...
...
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC309Test.php
View file @
7cc56c45
...
...
@@ -54,7 +54,7 @@ class DDC309Country
/**
* @Id
* @Column(name="id", type="integer")
* @GeneratedValue
(strategy="AUTO")
* @GeneratedValue
*/
public
$id
;
}
...
...
@@ -67,7 +67,7 @@ class DDC309User
/**
* @Id
* @Column(name="id", type="integer")
* @GeneratedValue
(strategy="AUTO")
* @GeneratedValue
*/
public
$id
;
}
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php
View file @
7cc56c45
...
...
@@ -118,13 +118,13 @@ class DDC345Membership
public
$id
;
/**
* @OneToOne(targetEntity="DDC345User")
* @OneToOne(targetEntity="DDC345User"
, inversedBy="Memberships"
)
* @JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*/
public
$user
;
/**
* @OneToOne(targetEntity="DDC345Group")
* @OneToOne(targetEntity="DDC345Group"
, inversedBy="Memberships"
)
* @JoinColumn(name="group_id", referencedColumnName="id", nullable=false)
*/
public
$group
;
...
...
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC353Test.php
View file @
7cc56c45
...
...
@@ -78,8 +78,7 @@ class DDC353Picture
{
/**
* @Column(name="picture_id", type="integer")
* @Id
* @GeneratedValue(strategy="AUTO")
* @Id @GeneratedValue
*/
private
$pictureId
;
...
...
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php
View file @
7cc56c45
...
...
@@ -53,7 +53,7 @@ class DDC371Child {
private
$id
;
/** @Column(type="string") */
public
$data
;
/** @ManyToOne(targetEntity="DDC371Parent") @JoinColumn(name="parentId") */
/** @ManyToOne(targetEntity="DDC371Parent"
, inversedBy="children"
) @JoinColumn(name="parentId") */
public
$parent
;
}
...
...
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php
View file @
7cc56c45
...
...
@@ -47,7 +47,7 @@ class DDC381Test extends \Doctrine\Tests\OrmFunctionalTestCase
class
DDC381Entity
{
/**
* @Id @Column(type="integer") @
g
eneratedValue
* @Id @Column(type="integer") @
G
eneratedValue
*/
protected
$id
;
...
...
tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php
View file @
7cc56c45
...
...
@@ -212,7 +212,7 @@ class Relation {
/**
* @var Lemma
* @ManyToOne(targetEntity="Lemma")
* @ManyToOne(targetEntity="Lemma"
, inversedBy="relations"
)
* @JoinColumn(name="relation_parent_id", referencedColumnName="lemma_id")
*/
private
$parent
;
...
...
@@ -226,7 +226,7 @@ class Relation {
/**
* @var RelationType
* @ManyToOne(targetEntity="RelationType")
* @ManyToOne(targetEntity="RelationType"
, inversedBy="relations"
)
* @JoinColumn(name="relation_type_id", referencedColumnName="relation_type_id")
*/
private
$type
;
...
...
tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
View file @
7cc56c45
...
...
@@ -73,7 +73,6 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase
public
function
testAssocations
(
$class
)
{
$this
->
assertEquals
(
3
,
count
(
$class
->
associationMappings
));
$this
->
assertEquals
(
1
,
count
(
$class
->
inverseMappings
));
return
$class
;
}
...
...
@@ -87,6 +86,7 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase
$this
->
assertTrue
(
$class
->
associationMappings
[
'address'
]
instanceof
\Doctrine\ORM\Mapping\OneToOneMapping
);
$this
->
assertTrue
(
isset
(
$class
->
associationMappings
[
'address'
]));
$this
->
assertTrue
(
$class
->
associationMappings
[
'address'
]
->
isOwningSide
);
$this
->
assertEquals
(
'user'
,
$class
->
associationMappings
[
'address'
]
->
inversedBy
);
// Check cascading
$this
->
assertTrue
(
$class
->
associationMappings
[
'address'
]
->
isCascadeRemove
);
$this
->
assertFalse
(
$class
->
associationMappings
[
'address'
]
->
isCascadePersist
);
...
...
@@ -223,13 +223,12 @@ class User
public
$email
;
/**
* @OneToOne(targetEntity="Address", cascade={"remove"})
* @OneToOne(targetEntity="Address", cascade={"remove"}
, inversedBy="user"
)
* @JoinColumn(onDelete="CASCADE", onUpdate="CASCADE")
*/
public
$address
;
/**
*
* @OneToMany(targetEntity="Phonenumber", mappedBy="user", cascade={"persist"})
* @OrderBy({"number"="ASC"})
*/
...
...
tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php
View file @
7cc56c45
...
...
@@ -100,8 +100,8 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
$this
->
assertTrue
(
$assoc
instanceof
\Doctrine\ORM\Mapping\ManyToManyMapping
);
$this
->
assertEquals
(
array
(
'name'
=>
'CmsUser_CmsGroup'
,
'joinColumns'
=>
array
(
array
(
'name'
=>
'CmsUser_id'
,
'referencedColumnName'
=>
'id'
)),
'inverseJoinColumns'
=>
array
(
array
(
'name'
=>
'CmsGroup_id'
,
'referencedColumnName'
=>
'id'
))
'joinColumns'
=>
array
(
array
(
'name'
=>
'CmsUser_id'
,
'referencedColumnName'
=>
'id'
,
'onDelete'
=>
'CASCADE'
)),
'inverseJoinColumns'
=>
array
(
array
(
'name'
=>
'CmsGroup_id'
,
'referencedColumnName'
=>
'id'
,
'onDelete'
=>
'CASCADE'
))
),
$assoc
->
joinTable
);
}
...
...
tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php
View file @
7cc56c45
...
...
@@ -39,6 +39,7 @@ $metadata->mapOneToOne(array(
0
=>
'remove'
,
),
'mappedBy'
=>
NULL
,
'inversedBy'
=>
'user'
,
'joinColumns'
=>
array
(
0
=>
...
...
tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml
View file @
7cc56c45
...
...
@@ -20,7 +20,7 @@
<field
name=
"name"
column=
"name"
type=
"string"
length=
"50"
nullable=
"true"
unique=
"true"
/>
<field
name=
"email"
column=
"user_email"
type=
"string"
column-definition=
"CHAR(32) NOT NULL"
/>
<one-to-one
field=
"address"
target-entity=
"Address"
>
<one-to-one
field=
"address"
target-entity=
"Address"
inversed-by=
"user"
>
<cascade><cascade-remove
/></cascade>
<join-column
name=
"address_id"
referenced-column-name=
"id"
on-delete=
"CASCADE"
on-update=
"CASCADE"
/>
</one-to-one>
...
...
tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml
View file @
7cc56c45
...
...
@@ -19,6 +19,7 @@ Doctrine\Tests\ORM\Mapping\User:
oneToOne
:
address
:
targetEntity
:
Address
inversedBy
:
user
joinColumn
:
name
:
address_id
referencedColumnName
:
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