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
deb095f2
Commit
deb095f2
authored
Feb 05, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some cleanups, docblocks, and a small needed refactoring of ClassMetadataFactory.
parent
efb733d7
Changes
25
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
241 additions
and
947 deletions
+241
-947
LICENSE
LICENSE
+1
-1
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+67
-17
SqlitePlatform.php
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
+22
-2
AbstractSchemaManager.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+2
-2
SqliteSchemaManager.php
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
+1
-1
Entity.php
lib/Doctrine/ORM/Entity.php
+0
-35
ClassExporter.php
lib/Doctrine/ORM/Export/ClassExporter.php
+2
-4
Assigned.php
lib/Doctrine/ORM/Id/Assigned.php
+1
-1
ArrayDriver.php
lib/Doctrine/ORM/Internal/Hydration/ArrayDriver.php
+0
-168
ObjectDriver.php
lib/Doctrine/ORM/Internal/Hydration/ObjectDriver.php
+0
-257
StandardHydrator.php
lib/Doctrine/ORM/Internal/Hydration/StandardHydrator.php
+0
-294
Null.php
lib/Doctrine/ORM/Internal/Null.php
+0
-65
ClassMetadata.php
lib/Doctrine/ORM/Mapping/ClassMetadata.php
+8
-7
ClassMetadataFactory.php
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
+41
-75
AnnotationDriver.php
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
+16
-0
OneToManyMapping.php
lib/Doctrine/ORM/Mapping/OneToManyMapping.php
+3
-1
OneToOneMapping.php
lib/Doctrine/ORM/Mapping/OneToOneMapping.php
+2
-0
PersistentCollection.php
lib/Doctrine/ORM/PersistentCollection.php
+0
-2
ManyToManyPersister.php
lib/Doctrine/ORM/Persisters/ManyToManyPersister.php
+18
-3
OneToManyPersister.php
lib/Doctrine/ORM/Persisters/OneToManyPersister.php
+21
-0
Query.php
lib/Doctrine/ORM/Query.php
+2
-3
SqlWalker.php
lib/Doctrine/ORM/Query/SqlWalker.php
+10
-3
EntityManagerMock.php
tests/Doctrine/Tests/Mocks/EntityManagerMock.php
+19
-0
MetadataDriverMock.php
tests/Doctrine/Tests/Mocks/MetadataDriverMock.php
+5
-1
UnitOfWorkTest.php
tests/Doctrine/Tests/ORM/UnitOfWorkTest.php
+0
-5
No files found.
LICENSE
View file @
deb095f2
...
...
@@ -13,4 +13,4 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
and is licensed under the LGPL. For more information, see <http://www.phpdoctrine.org>.
\ No newline at end of file
and is licensed under the LGPL. For more information, see <http://www.doctrine-project.org>.
\ No newline at end of file
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
deb095f2
...
...
@@ -55,11 +55,19 @@ abstract class AbstractPlatform
*/
public
function
__construct
()
{}
/**
* Sets whether to quote identifiers.
*/
public
function
setQuoteIdentifiers
(
$bool
)
{
$this
->
_quoteIdentifiers
=
(
bool
)
$bool
;
}
/**
* Gets whether to quote identifiers.
*
* @return boolean
*/
public
function
getQuoteIdentifiers
()
{
return
$this
->
_quoteIdentifiers
;
...
...
@@ -1752,7 +1760,7 @@ abstract class AbstractPlatform
* @return string
* @todo Remove the ORM dependency
*/
public
function
writeLimitClauseInSubquery
(
Doctrine_
ClassMetadata
$rootClass
,
public
function
writeLimitClauseInSubquery
(
\Doctrine\ORM\Mapping\
ClassMetadata
$rootClass
,
$query
,
$limit
=
false
,
$offset
=
false
)
{
return
$this
->
modifyLimitQuery
(
$query
,
$limit
,
$offset
);
...
...
@@ -1778,7 +1786,6 @@ abstract class AbstractPlatform
* Default conversion defined here converts to integers.
*
* @param array $item
* @return void
*/
public
function
convertBooleans
(
$item
)
{
...
...
@@ -1797,9 +1804,9 @@ abstract class AbstractPlatform
}
/**
*
Enter description here..
.
*
Gets the SQL statement specific for the platform to set the charset
.
*
* @param
unknown_type
$charset
* @param
string
$charset
* @return string
*/
public
function
getSetCharsetSql
(
$charset
)
...
...
@@ -1810,7 +1817,7 @@ abstract class AbstractPlatform
/**
* Enter description here...
*
* @param
unknown_type
$level
* @param
integer
$level
*/
protected
function
_getTransactionIsolationLevelSql
(
$level
)
{
...
...
@@ -1831,7 +1838,7 @@ abstract class AbstractPlatform
/**
* Enter description here...
*
* @param
unknown_type
$level
* @param
integer
$level
*/
public
function
getSetTransactionIsolationSql
(
$level
)
{
...
...
@@ -1842,7 +1849,7 @@ abstract class AbstractPlatform
* Gets the default transaction isolation level of the platform.
*
* @return integer The default isolation level.
* @see Doctrine
::DBAL::Connection::
TRANSACTION_* constants.
* @see Doctrine
\DBAL\Connection\
TRANSACTION_* constants.
*/
public
function
getDefaultTransactionIsolationLevel
()
{
...
...
@@ -1852,41 +1859,84 @@ abstract class AbstractPlatform
/* supports*() metods */
/**
* Whether the platform supports sequences.
*
* @return boolean
*/
public
function
supportsSequences
()
{
return
false
;
}
/**
* Whether the platform supports identity columns.
* Identity columns are columns that recieve an auto-generated value from the
* database on insert of a row.
*
* @return boolean
*/
public
function
supportsIdentityColumns
()
{
return
false
;
}
/**
* Whether the platform supports indexes.
*
* @return boolean
*/
public
function
supportsIndexes
()
{
return
true
;
}
/**
* Whether the platform supports transactions.
*
* @return boolean
*/
public
function
supportsTransactions
()
{
return
true
;
}
/**
* Whether the platform supports savepoints.
*
* @return boolean
*/
public
function
supportsSavepoints
()
{
return
true
;
}
/**
* Whether the platform supports primary key constraints.
*
* @return boolean
*/
public
function
supportsPrimaryConstraints
()
{
return
true
;
}
/**
* Whether the platform supports foreign key constraints.
*
* @return boolean
*/
public
function
supportsForeignKeyConstraints
()
{
return
true
;
}
/**
* Whether the platform supports getting the affected rows or a recent
* update/delete type query.
*
* @return boolean
*/
public
function
supportsGettingAffectedRows
()
{
return
true
;
...
...
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
View file @
deb095f2
<?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
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL\Platforms
;
/**
* Enter description here...
* The SqlitePlatform class describes the specifics and dialects of the SQLite
* database platform.
*
* @since 2.0
*/
...
...
@@ -537,7 +557,7 @@ class SqlitePlatform extends AbstractPlatform
* This really limits their usefulness and requires SQLite specific handling, so
* we simply say that SQLite does NOT support foreign keys for now...
*
* @return boolean
* @return boolean
FALSE
* @override
*/
public
function
supportsForeignKeyConstraints
()
...
...
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
deb095f2
...
...
@@ -16,14 +16,14 @@
*
* 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\DBAL\Schema
;
/**
* Base class for schema managers. Schema managers are used to inspect and/or
* modify the database schema.
* modify the database schema
/structure
.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
...
...
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
View file @
deb095f2
...
...
@@ -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\DBAL\Schema
;
...
...
lib/Doctrine/ORM/Entity.php
deleted
100644 → 0
View file @
efb733d7
<?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
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine\ORM;
/**
* Entity marker interface.
*
* @author Roman Borschel <roman@code-factory.org>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 4342 $
* @DEPRECATED
*/
interface
Doctrine_ORM_Entity
{}
lib/Doctrine/ORM/Export/ClassExporter.php
View file @
deb095f2
<?php
/*
* $Id
: Export.php 4805 2008-08-25 19:11:58Z subzero2000
$
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
...
...
@@ -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\ORM\Export
;
...
...
@@ -27,8 +27,6 @@ use Doctrine\ORM\EntityManager;
* The ClassExporter can generate database schemas/structures from ClassMetadata
* class descriptors.
*
* @package Doctrine
* @subpackage Export
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @author Roman Borschel <roman@code-factory.org>
...
...
lib/Doctrine/ORM/Id/Assigned.php
View file @
deb095f2
...
...
@@ -34,7 +34,7 @@ class Assigned extends AbstractIdGenerator
/**
* Returns the identifier assigned to the given entity.
*
* @param
Doctrine\ORM\Entity
$entity
* @param
object
$entity
* @return mixed
* @override
*/
...
...
lib/Doctrine/ORM/Internal/Hydration/ArrayDriver.php
deleted
100644 → 0
View file @
efb733d7
<?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
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine\ORM\Internal\Hydration;
/**
* Defines an array hydration strategy.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
* @DEPRECATED
*/
class
Doctrine_ORM_Internal_Hydration_ArrayDriver
{
/**
*
*/
public
function
getElementCollection
(
$component
)
{
return
array
();
}
/**
*
*/
public
function
getElement
(
array
$data
,
$component
)
{
return
$data
;
}
/**
*
*/
public
function
registerCollection
(
$coll
)
{
/* Nothing to do */
}
/**
*
*/
public
function
initRelatedCollection
(
array
&
$data
,
$name
)
{
if
(
!
isset
(
$data
[
$name
]))
{
$data
[
$name
]
=
array
();
}
}
public
function
addRelatedIndexedElement
(
array
&
$entity1
,
$property
,
array
&
$entity2
,
$indexField
)
{
$entity1
[
$property
][
$entity2
[
$indexField
]]
=
$entity2
;
}
public
function
addRelatedElement
(
array
&
$entity1
,
$property
,
array
&
$entity2
)
{
$entity1
[
$property
][]
=
$entity2
;
}
public
function
setRelatedElement
(
array
&
$entity1
,
$property
,
&
$entity2
)
{
$entity1
[
$property
]
=
$entity2
;
}
public
function
isIndexKeyInUse
(
array
&
$entity
,
$assocField
,
$indexField
)
{
return
isset
(
$entity
[
$assocField
][
$indexField
]);
}
public
function
isFieldSet
(
array
&
$entity
,
$field
)
{
return
isset
(
$entity
[
$field
]);
}
public
function
getFieldValue
(
array
&
$entity
,
$field
)
{
return
$entity
[
$field
];
}
public
function
&
getReferenceValue
(
array
&
$entity
,
$field
)
{
return
$entity
[
$field
];
}
public
function
addElementToIndexedCollection
(
array
&
$coll
,
array
&
$entity
,
$keyField
)
{
$coll
[
$entity
[
$keyField
]]
=
$entity
;
}
public
function
addElementToCollection
(
array
&
$coll
,
array
&
$entity
)
{
$coll
[]
=
$entity
;
}
/**
*
*/
public
function
getNullPointer
()
{
return
null
;
}
/**
*
*/
public
function
getLastKey
(
&
$data
)
{
end
(
$data
);
return
key
(
$data
);
}
/**
* Updates the result pointer for an Entity. The result pointers point to the
* last seen instance of each Entity type. This is used for graph construction.
*
* @param array $resultPointers The result pointers.
* @param array $coll The element.
* @param boolean|integer $index Index of the element in the collection.
* @param string $dqlAlias
* @param boolean $oneToOne Whether it is a single-valued association or not.
*/
public
function
updateResultPointer
(
&
$resultPointers
,
&
$coll
,
$index
,
$dqlAlias
,
$oneToOne
)
{
if
(
$coll
===
null
)
{
unset
(
$resultPointers
[
$dqlAlias
]);
// Ticket #1228
return
;
}
if
(
$index
!==
false
)
{
$resultPointers
[
$dqlAlias
]
=&
$coll
[
$index
];
return
;
}
if
(
$coll
)
{
if
(
$oneToOne
)
{
$resultPointers
[
$dqlAlias
]
=&
$coll
;
}
else
{
end
(
$coll
);
$resultPointers
[
$dqlAlias
]
=&
$coll
[
key
(
$coll
)];
}
}
}
/**
*
*/
public
function
flush
()
{
/* Nothing to do */
}
}
lib/Doctrine/ORM/Internal/Hydration/ObjectDriver.php
deleted
100644 → 0
View file @
efb733d7
<?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
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
#namespace Doctrine\ORM\Internal\Hydration;
/**
* Defines the object hydration strategy.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
* @internal All the methods in this class are performance-sentitive.
* @DEPRECATED
*/
class
Doctrine_ORM_Internal_Hydration_ObjectDriver
{
/** Collections initialized by the driver */
protected
$_collections
=
array
();
/** Memory for initialized relations */
private
$_initializedRelations
=
array
();
/** Null object */
//private $_nullObject;
/** The EntityManager */
private
$_em
;
private
$_uow
;
private
$_metadataMap
=
array
();
private
$_entityData
=
array
();
public
function
__construct
(
Doctrine_ORM_EntityManager
$em
)
{
//$this->_nullObject = Doctrine_ORM_Internal_Null::$INSTANCE;
$this
->
_em
=
$em
;
$this
->
_uow
=
$this
->
_em
->
getUnitOfWork
();
}
public
function
getElementCollection
(
$component
)
{
$coll
=
new
Doctrine_ORM_Collection
(
$this
->
_em
,
$component
);
$this
->
_collections
[]
=
$coll
;
return
$coll
;
}
public
function
getLastKey
(
$coll
)
{
// check needed because of mixed results.
// is_object instead of is_array because is_array is slow on large arrays.
if
(
is_object
(
$coll
))
{
$coll
->
last
();
return
$coll
->
key
();
}
else
{
end
(
$coll
);
return
key
(
$coll
);
}
}
public
function
initRelatedCollection
(
$entity
,
$name
)
{
$oid
=
spl_object_hash
(
$entity
);
$classMetadata
=
$this
->
_metadataMap
[
$oid
];
if
(
!
isset
(
$this
->
_initializedRelations
[
$oid
][
$name
]))
{
$relation
=
$classMetadata
->
getAssociationMapping
(
$name
);
$relatedClass
=
$this
->
_em
->
getClassMetadata
(
$relation
->
getTargetEntityName
());
$coll
=
$this
->
getElementCollection
(
$relatedClass
->
getClassName
());
$coll
->
_setOwner
(
$entity
,
$relation
);
$coll
->
_setHydrationFlag
(
true
);
$classMetadata
->
getReflectionProperty
(
$name
)
->
setValue
(
$entity
,
$coll
);
$this
->
_initializedRelations
[
$oid
][
$name
]
=
true
;
$this
->
_uow
->
setOriginalEntityProperty
(
$oid
,
$name
,
$coll
);
}
}
public
function
registerCollection
(
Doctrine_ORM_Collection
$coll
)
{
$this
->
_collections
[]
=
$coll
;
}
public
function
getNullPointer
()
{
//TODO: Return VirtualProxy if lazy association
return
null
;
}
public
function
getElement
(
array
$data
,
$className
)
{
$entity
=
$this
->
_em
->
getUnitOfWork
()
->
createEntity
(
$className
,
$data
);
$oid
=
spl_object_hash
(
$entity
);
$this
->
_metadataMap
[
$oid
]
=
$this
->
_em
->
getClassMetadata
(
$className
);
return
$entity
;
}
/**
* Adds an element to an indexed collection-valued property.
*
* @param <type> $entity1
* @param <type> $property
* @param <type> $entity2
* @param <type> $indexField
*/
public
function
addRelatedIndexedElement
(
$entity1
,
$property
,
$entity2
,
$indexField
)
{
$classMetadata1
=
$this
->
_metadataMap
[
spl_object_hash
(
$entity1
)];
$classMetadata2
=
$this
->
_metadataMap
[
spl_object_hash
(
$entity2
)];
$indexValue
=
$classMetadata2
->
getReflectionProperty
(
$indexField
)
->
getValue
(
$entity2
);
$classMetadata1
->
getReflectionProperty
(
$property
)
->
getValue
(
$entity1
)
->
set
(
$indexValue
,
$entity2
);
}
/**
* Adds an element to a collection-valued property.
*
* @param <type> $entity1
* @param <type> $property
* @param <type> $entity2
*/
public
function
addRelatedElement
(
$entity1
,
$property
,
$entity2
)
{
$classMetadata1
=
$this
->
_metadataMap
[
spl_object_hash
(
$entity1
)];
$classMetadata1
->
getReflectionProperty
(
$property
)
->
getValue
(
$entity1
)
->
add
(
$entity2
);
}
/**
* Sets a related element.
*
* @param <type> $entity1
* @param <type> $property
* @param <type> $entity2
*/
public
function
setRelatedElement
(
$entity1
,
$property
,
$entity2
)
{
$oid
=
spl_object_hash
(
$entity1
);
$classMetadata1
=
$this
->
_metadataMap
[
$oid
];
$classMetadata1
->
getReflectionProperty
(
$property
)
->
setValue
(
$entity1
,
$entity2
);
$this
->
_uow
->
setOriginalEntityProperty
(
$oid
,
$property
,
$entity2
);
$relation
=
$classMetadata1
->
getAssociationMapping
(
$property
);
if
(
$relation
->
isOneToOne
())
{
$targetClass
=
$this
->
_em
->
getClassMetadata
(
$relation
->
getTargetEntityName
());
if
(
$relation
->
isOwningSide
())
{
// If there is an inverse mapping on the target class its bidirectional
if
(
$targetClass
->
hasInverseAssociationMapping
(
$property
))
{
$oid2
=
spl_object_hash
(
$entity2
);
$sourceProp
=
$targetClass
->
getInverseAssociationMapping
(
$fieldName
)
->
getSourceFieldName
();
$targetClass
->
getReflectionProperty
(
$sourceProp
)
->
setValue
(
$entity2
,
$entity1
);
//$this->_entityData[$oid2][$sourceProp] = $entity1;
}
}
else
{
// for sure bidirectional, as there is no inverse side in unidirectional
$mappedByProp
=
$relation
->
getMappedByFieldName
();
$targetClass
->
getReflectionProperty
(
$mappedByProp
)
->
setValue
(
$entity2
,
$entity1
);
//$this->_entityData[spl_object_hash($entity2)][$mappedByProp] = $entity1;
}
}
}
public
function
isIndexKeyInUse
(
$entity
,
$assocField
,
$indexField
)
{
return
$this
->
_metadataMap
[
spl_object_hash
(
$entity
)]
->
getReflectionProperty
(
$assocField
)
->
getValue
(
$entity
)
->
containsKey
(
$indexField
);
}
public
function
isFieldSet
(
$entity
,
$field
)
{
return
$this
->
_metadataMap
[
spl_object_hash
(
$entity
)]
->
getReflectionProperty
(
$field
)
->
getValue
(
$entity
)
!==
null
;
}
public
function
getFieldValue
(
$entity
,
$field
)
{
return
$this
->
_metadataMap
[
spl_object_hash
(
$entity
)]
->
getReflectionProperty
(
$field
)
->
getValue
(
$entity
);
}
public
function
getReferenceValue
(
$entity
,
$field
)
{
return
$this
->
_metadataMap
[
spl_object_hash
(
$entity
)]
->
getReflectionProperty
(
$field
)
->
getValue
(
$entity
);
}
public
function
addElementToIndexedCollection
(
$coll
,
$entity
,
$keyField
)
{
$coll
->
set
(
$entity
,
$this
->
getFieldValue
(
$keyField
,
$entity
));
}
public
function
addElementToCollection
(
$coll
,
$entity
)
{
$coll
->
add
(
$entity
);
}
/**
* Updates the result pointer for an Entity. The result pointers point to the
* last seen instance of each Entity type. This is used for graph construction.
*
* @param array $resultPointers The result pointers.
* @param Collection $coll The element.
* @param boolean|integer $index Index of the element in the collection.
* @param string $dqlAlias
* @param boolean $oneToOne Whether it is a single-valued association or not.
*/
public
function
updateResultPointer
(
&
$resultPointers
,
&
$coll
,
$index
,
$dqlAlias
,
$oneToOne
)
{
if
(
$coll
===
null
)
{
unset
(
$resultPointers
[
$dqlAlias
]);
// Ticket #1228
return
;
}
if
(
$index
!==
false
)
{
$resultPointers
[
$dqlAlias
]
=
$coll
[
$index
];
return
;
}
if
(
!
is_object
(
$coll
))
{
end
(
$coll
);
$resultPointers
[
$dqlAlias
]
=&
$coll
[
key
(
$coll
)];
}
else
if
(
$coll
instanceof
Doctrine_ORM_Collection
)
{
if
(
count
(
$coll
)
>
0
)
{
$resultPointers
[
$dqlAlias
]
=
$coll
->
last
();
}
}
else
{
$resultPointers
[
$dqlAlias
]
=
$coll
;
}
}
public
function
flush
()
{
// take snapshots from all initialized collections
foreach
(
$this
->
_collections
as
$coll
)
{
$coll
->
_takeSnapshot
();
$coll
->
_setHydrationFlag
(
false
);
$this
->
_uow
->
addManagedCollection
(
$coll
);
}
// clean up
$this
->
_collections
=
array
();
$this
->
_initializedRelations
=
array
();
$this
->
_metadataMap
=
array
();
$this
->
_entityData
=
array
();
}
}
lib/Doctrine/ORM/Internal/Hydration/StandardHydrator.php
deleted
100644 → 0
View file @
efb733d7
This diff is collapsed.
Click to expand it.
lib/Doctrine/ORM/Internal/Null.php
deleted
100644 → 0
View file @
efb733d7
<?php
/*
* $Id: Null.php 4723 2008-08-01 18:46:14Z romanb $
*
* 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
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine\ORM\Internal;
/**
* Null class representing a null value that has been fetched from
* the database or a fetched, empty association. This is for internal use only.
* User code should never deal with this null object.
*
* Semantics are as follows:
*
* Regular PHP null : Value is undefined. When a field with that value is accessed
* and lazy loading is used the database is queried.
*
* Null object: Null valued of a field or empty association that has already been loaded.
* On access, the database is not queried.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 4723 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @todo No longer needed?
* @DEPRECATED
*/
// static initializer
Doctrine_ORM_Internal_Null
::
$INSTANCE
=
new
Doctrine_ORM_Internal_Null
();
final
class
Doctrine_ORM_Internal_Null
{
public
static
$INSTANCE
;
public
function
__construct
()
{}
public
static
function
getInstance
()
{
return
self
::
$INSTANCE
;
}
public
function
exists
()
{
return
false
;
}
public
function
__toString
()
{
return
''
;
}
}
\ No newline at end of file
lib/Doctrine/ORM/Mapping/ClassMetadata.php
View file @
deb095f2
...
...
@@ -23,6 +23,7 @@ namespace Doctrine\ORM\Mapping;
use
\ReflectionClass
;
use
Doctrine\Common\DoctrineException
;
use
Doctrine\ORM\Exceptions\MappingException
;
/**
* A <tt>ClassMetadata</tt> instance holds all the information (metadata) of an entity and
...
...
@@ -506,7 +507,7 @@ class ClassMetadata
public
function
getFieldMapping
(
$fieldName
)
{
if
(
!
isset
(
$this
->
_fieldMappings
[
$fieldName
]))
{
throw
Doctrine_
MappingException
::
mappingNotFound
(
$fieldName
);
throw
MappingException
::
mappingNotFound
(
$fieldName
);
}
return
$this
->
_fieldMappings
[
$fieldName
];
}
...
...
@@ -620,10 +621,10 @@ class ClassMetadata
{
// Check mandatory fields
if
(
!
isset
(
$mapping
[
'fieldName'
]))
{
throw
Doctrine_ORM_Exceptions_
MappingException
::
missingFieldName
();
throw
MappingException
::
missingFieldName
();
}
if
(
!
isset
(
$mapping
[
'type'
]))
{
throw
Doctrine_ORM_Exceptions_
MappingException
::
missingType
();
throw
MappingException
::
missingType
();
}
if
(
!
is_object
(
$mapping
[
'type'
]))
{
...
...
@@ -648,9 +649,9 @@ class ClassMetadata
if
(
isset
(
$mapping
[
'idGenerator'
]))
{
if
(
!
$this
->
_isIdGeneratorType
(
$mapping
[
'idGenerator'
]))
{
//TODO: check if the idGenerator specifies an existing generator by name
throw
Doctrine_
MappingException
::
invalidGeneratorType
(
$mapping
[
'idGenerator'
]);
throw
MappingException
::
invalidGeneratorType
(
$mapping
[
'idGenerator'
]);
}
else
if
(
count
(
$this
->
_identifier
)
>
1
)
{
throw
Doctrine_
MappingException
::
generatorNotAllowedWithCompositeId
();
throw
MappingException
::
generatorNotAllowedWithCompositeId
();
}
$this
->
_generatorType
=
$mapping
[
'idGenerator'
];
}
...
...
@@ -1055,12 +1056,12 @@ class ClassMetadata
public
function
setInheritanceType
(
$type
)
{
if
(
$parentClassNames
=
$this
->
getParentClasses
())
{
throw
new
Doctrine_
MappingException
(
"All classes in an inheritance hierarchy"
throw
new
MappingException
(
"All classes in an inheritance hierarchy"
.
" must share the same inheritance mapping type and this type must be set"
.
" in the root class of the hierarchy."
);
}
if
(
!
$this
->
_isInheritanceType
(
$type
))
{
throw
Doctrine_
MappingException
::
invalidInheritanceType
(
$type
);
throw
MappingException
::
invalidInheritanceType
(
$type
);
}
$this
->
_inheritanceType
=
$type
;
}
...
...
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
View file @
deb095f2
...
...
@@ -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\ORM\Mapping
;
...
...
@@ -28,7 +28,6 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
* metadata mapping informations of a class which describes how a class should be mapped
* to a relational database.
*
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version $Revision$
...
...
@@ -58,7 +57,7 @@ class ClassMetadataFactory
/**
* Sets the cache driver used by the factory to cache ClassMetadata instances.
*
* @param
object
$cacheDriver
* @param
Doctrine\ORM\Cache\Cache
$cacheDriver
*/
public
function
setCacheDriver
(
$cacheDriver
)
{
...
...
@@ -68,7 +67,7 @@ class ClassMetadataFactory
/**
* Gets the cache driver used by the factory to cache ClassMetadata instances.
*
* @return
object
* @return
Doctrine\ORM\Cache\Cache
*/
public
function
getCacheDriver
()
{
...
...
@@ -108,51 +107,43 @@ class ClassMetadataFactory
*/
protected
function
_loadMetadata
(
$name
)
{
// Collect parent classes, ignoring transient (not-mapped) classes.
$parentClass
=
$name
;
$parentClasses
=
array
();
$loadedParentClass
=
false
;
while
(
$parentClass
=
get_parent_class
(
$parentClass
))
{
if
(
isset
(
$this
->
_loadedMetadata
[
$parentClass
]))
{
$loadedParentClass
=
$parentClass
;
break
;
}
if
(
!
$this
->
_driver
->
isTransient
(
$parentClass
))
{
$parentClasses
[]
=
$parentClass
;
}
}
$parentClasses
=
array_reverse
(
$parentClasses
);
$parentClasses
[]
=
$name
;
if
(
$loadedParentClass
)
{
$class
=
$this
->
_loadedMetadata
[
$loadedParentClass
];
}
else
{
$rootClassOfHierarchy
=
count
(
$parentClasses
)
>
0
?
array_shift
(
$parentClasses
)
:
$name
;
$class
=
$this
->
_newClassMetadataInstance
(
$rootClassOfHierarchy
);
$this
->
_loadClassMetadata
(
$class
,
$rootClassOfHierarchy
);
$this
->
_loadedMetadata
[
$rootClassOfHierarchy
]
=
$class
;
// Move down the hierarchy of parent classes, starting from the topmost class
$parent
=
null
;
$visited
=
array
();
foreach
(
$parentClasses
as
$className
)
{
$class
=
$this
->
_newClassMetadataInstance
(
$className
);
if
(
$parent
)
{
$class
->
setInheritanceType
(
$parent
->
getInheritanceType
());
$class
->
setDiscriminatorMap
(
$parent
->
getDiscriminatorMap
());
$class
->
setDiscriminatorColumn
(
$parent
->
getDiscriminatorColumn
());
$class
->
setIdGeneratorType
(
$parent
->
getIdGeneratorType
());
$this
->
_addInheritedFields
(
$class
,
$parent
);
$this
->
_addInheritedRelations
(
$class
,
$parent
);
}
if
(
count
(
$parentClasses
)
==
0
)
{
return
$class
;
}
// Invoke driver
$this
->
_driver
->
loadMetadataForClass
(
$className
,
$class
)
;
$this
->
_completeIdGeneratorMapping
(
$class
);
// load metadata of subclasses
// -> child1 -> child2 -> $name
if
(
$parent
&&
$parent
->
isInheritanceTypeSingleTable
())
{
$class
->
setTableName
(
$parent
->
getTableName
());
}
// Move down the hierarchy of parent classes, starting from the topmost class
$this
->
_loadedMetadata
[
$className
]
=
$class
;
$parent
=
$class
;
foreach
(
$parentClasses
as
$subclassName
)
{
$subClass
=
$this
->
_newClassMetadataInstance
(
$subclassName
);
$subClass
->
setInheritanceType
(
$parent
->
getInheritanceType
());
$subClass
->
setDiscriminatorMap
(
$parent
->
getDiscriminatorMap
());
$subClass
->
setDiscriminatorColumn
(
$parent
->
getDiscriminatorColumn
());
$subClass
->
setIdGeneratorType
(
$parent
->
getIdGeneratorType
());
$this
->
_addInheritedFields
(
$subClass
,
$parent
);
$this
->
_addInheritedRelations
(
$subClass
,
$parent
);
$this
->
_loadClassMetadata
(
$subClass
,
$subclassName
);
if
(
$parent
->
isInheritanceTypeSingleTable
())
{
$subClass
->
setTableName
(
$parent
->
getTableName
());
}
$this
->
_loadedMetadata
[
$subclassName
]
=
$subClass
;
$parent
=
$subClass
;
$class
->
setParentClasses
(
$visited
);
array_unshift
(
$visited
,
$className
);
}
}
...
...
@@ -173,7 +164,7 @@ class ClassMetadataFactory
* @param Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param Doctrine\ORM\Mapping\ClassMetadata $parentClass
*/
private
function
_addInheritedFields
(
$subClass
,
$parentClass
)
private
function
_addInheritedFields
(
ClassMetadata
$subClass
,
ClassMetadata
$parentClass
)
{
foreach
(
$parentClass
->
getFieldMappings
()
as
$fieldName
=>
$mapping
)
{
if
(
!
isset
(
$mapping
[
'inherited'
]))
{
...
...
@@ -189,7 +180,7 @@ class ClassMetadataFactory
* @param Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param Doctrine\ORM\Mapping\ClassMetadata $parentClass
*/
private
function
_addInheritedRelations
(
$subClass
,
$parentClass
)
private
function
_addInheritedRelations
(
ClassMetadata
$subClass
,
ClassMetadata
$parentClass
)
{
foreach
(
$parentClass
->
getAssociationMappings
()
as
$mapping
)
{
$subClass
->
addAssociationMapping
(
$mapping
);
...
...
@@ -197,47 +188,22 @@ class ClassMetadataFactory
}
/**
* Loads the metadata of a specified class.
* Completes the ID generator mapping. If "auto" is specified we choose the generator
* most appropriate for the targeted database platform.
*
* @param Doctrine_ClassMetadata $class The container for the metadata.
* @param string $name The name of the class for which the metadata will be loaded.
* @param Doctrine\ORM\Mapping\ClassMetadata $class
*/
private
function
_
loadClassMetadata
(
ClassMetadata
$class
,
$name
)
private
function
_
completeIdGeneratorMapping
(
ClassMetadata
$class
)
{
if
(
!
class_exists
(
$name
)
||
empty
(
$name
))
{
throw
new
DoctrineException
(
"Couldn't find class "
.
$name
.
"."
);
}
$names
=
array
();
$className
=
$name
;
// get parent classes
//TODO: Skip Entity types MappedSuperclass/Transient
do
{
if
(
$className
==
$name
)
{
continue
;
}
$names
[]
=
$className
;
}
while
(
$className
=
get_parent_class
(
$className
));
// save parents
$class
->
setParentClasses
(
$names
);
// load user-specified mapping metadata through the driver
$this
->
_driver
->
loadMetadataForClass
(
$name
,
$class
);
// Complete Id generator mapping. If AUTO is specified we choose the generator
// most appropriate for the target platform.
if
(
$class
->
getIdGeneratorType
()
==
\Doctrine\ORM\Mapping\ClassMetadata
::
GENERATOR_TYPE_AUTO
)
{
if
(
$class
->
getIdGeneratorType
()
==
ClassMetadata
::
GENERATOR_TYPE_AUTO
)
{
if
(
$this
->
_targetPlatform
->
prefersSequences
())
{
$class
->
setIdGeneratorType
(
\Doctrine\ORM\Mapping\
ClassMetadata
::
GENERATOR_TYPE_SEQUENCE
);
$class
->
setIdGeneratorType
(
ClassMetadata
::
GENERATOR_TYPE_SEQUENCE
);
}
else
if
(
$this
->
_targetPlatform
->
prefersIdentityColumns
())
{
$class
->
setIdGeneratorType
(
\Doctrine\ORM\Mapping\
ClassMetadata
::
GENERATOR_TYPE_IDENTITY
);
$class
->
setIdGeneratorType
(
ClassMetadata
::
GENERATOR_TYPE_IDENTITY
);
}
else
{
$class
->
setIdGeneratorType
(
\Doctrine\ORM\Mapping\
ClassMetadata
::
GENERATOR_TYPE_TABLE
);
$class
->
setIdGeneratorType
(
ClassMetadata
::
GENERATOR_TYPE_TABLE
);
}
}
return
$class
;
}
}
...
...
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
View file @
deb095f2
...
...
@@ -153,4 +153,20 @@ class AnnotationDriver
}
}
/**
* Whether the class with the specified name should have its metadata loaded.
* This is only the case if it is annotated with either @DoctrineEntity or
* @DoctrineMappedSuperclass in the class doc block.
*
* @param string $className
* @return boolean
*/
public
function
isTransient
(
$className
)
{
$refClass
=
new
\ReflectionClass
(
$className
);
$docComment
=
$refClass
->
getDocComment
();
return
strpos
(
$docComment
,
'@DoctrineEntity'
)
===
false
&&
strpos
(
$docComment
,
'@DoctrineMappedSuperclass'
)
===
false
;
}
}
lib/Doctrine/ORM/Mapping/OneToManyMapping.php
View file @
deb095f2
...
...
@@ -21,6 +21,8 @@
namespace
Doctrine\ORM\Mapping
;
use
Doctrine\ORM\Exceptions\MappingException
;
/**
* Represents a one-to-many mapping.
*
...
...
@@ -76,7 +78,7 @@ class OneToManyMapping extends AssociationMapping
// one-side MUST be inverse (must have mappedBy)
if
(
!
isset
(
$mapping
[
'mappedBy'
]))
{
throw
Doctrine_
MappingException
::
oneToManyRequiresMappedBy
(
$mapping
[
'fieldName'
]);
throw
MappingException
::
oneToManyRequiresMappedBy
(
$mapping
[
'fieldName'
]);
}
$this
->
_deleteOrphans
=
isset
(
$mapping
[
'deleteOrphans'
])
?
...
...
lib/Doctrine/ORM/Mapping/OneToOneMapping.php
View file @
deb095f2
...
...
@@ -21,6 +21,8 @@
namespace
Doctrine\ORM\Mapping
;
use
Doctrine\ORM\Exceptions\MappingException
;
/**
* A one-to-one mapping describes a uni-directional mapping from one entity
* to another entity.
...
...
lib/Doctrine/ORM/PersistentCollection.php
View file @
deb095f2
...
...
@@ -24,8 +24,6 @@ namespace Doctrine\ORM;
use
Doctrine\ORM\Mapping\AssociationMapping
;
/**
* A persistent collection wrapper.
*
* A PersistentCollection represents a collection of elements that have persistent state.
* Collections of entities represent only the associations (links) to those entities.
* That means, if the collection is part of a many-many mapping and you remove
...
...
lib/Doctrine/ORM/Persisters/ManyToManyPersister.php
View file @
deb095f2
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* $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
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\ORM\Persisters
;
...
...
lib/Doctrine/ORM/Persisters/OneToManyPersister.php
View file @
deb095f2
<?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
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\ORM\Persisters
;
...
...
@@ -6,6 +25,8 @@ use Doctrine\ORM\PersistentCollection;
/**
* Persister for one-to-many collections.
*
* @since 2.0
*/
class
OneToManyPersister
extends
AbstractCollectionPersister
{
...
...
lib/Doctrine/ORM/Query.php
View file @
deb095f2
<?php
/*
* $Id
: Query.php 3938 2008-03-06 19:36:50Z romanb
$
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
...
...
@@ -17,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\ORM
;
...
...
lib/Doctrine/ORM/Query/SqlWalker.php
View file @
deb095f2
...
...
@@ -9,9 +9,13 @@ namespace Doctrine\ORM\Query;
use
Doctrine\ORM\Query\AST
;
/**
* Description of SqlWalker
* The SqlWalker walks over an AST that represents a DQL query and constructs
* the corresponding SQL. The walking can start at any node, not only at some root
* node. Therefore it is possible to only generate SQL parts by simply walking over
* certain subtrees of the AST.
*
* @author robo
* @since 2.0
*/
class
SqlWalker
{
...
...
@@ -27,6 +31,9 @@ class SqlWalker
private
$_dqlToSqlAliasMap
=
array
();
private
$_scalarAliasCounter
=
0
;
/**
* Initializes a new SqlWalker instance.
*/
public
function
__construct
(
$em
,
$parserResult
)
{
$this
->
_em
=
$em
;
...
...
@@ -157,9 +164,9 @@ class SqlWalker
$sql
.=
$sqlTableAlias
.
'.'
.
$class
->
getColumnName
(
$fieldName
)
.
' AS '
.
$sqlTableAlias
.
'__'
.
$class
->
getColumnName
(
$fieldName
);
}
else
if
(
$pathExpression
->
isSimpleStateFieldAssociationPathExpression
())
{
throw
new
Doctrine
_
Exception
(
"Not yet implemented."
);
throw
new
DoctrineException
(
"Not yet implemented."
);
}
else
{
throw
new
Doctrine
_ORM_Query_
Exception
(
"Encountered invalid PathExpression during SQL construction."
);
throw
new
DoctrineException
(
"Encountered invalid PathExpression during SQL construction."
);
}
}
else
if
(
$selectExpression
->
getExpression
()
instanceof
AST\AggregateExpression
)
{
...
...
tests/Doctrine/Tests/Mocks/EntityManagerMock.php
View file @
deb095f2
<?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
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\Tests\Mocks
;
...
...
tests/Doctrine/Tests/Mocks/MetadataDriverMock.php
View file @
deb095f2
...
...
@@ -11,9 +11,13 @@ namespace Doctrine\Tests\Mocks;
*
* @author robo
*/
class
MetadataDriverMock
{
class
MetadataDriverMock
{
public
function
loadMetadataForClass
(
$className
,
\Doctrine\ORM\Mapping\ClassMetadata
$metadata
)
{
return
;
}
public
function
isTransient
(
$className
)
{
return
false
;
}
}
tests/Doctrine/Tests/ORM/UnitOfWorkTest.php
View file @
deb095f2
...
...
@@ -13,11 +13,6 @@ use Doctrine\Tests\Models\Forum\ForumAvatar;
require_once
__DIR__
.
'/../TestInit.php'
;
#require_once 'lib/mocks/Doctrine_EntityManagerMock.php';
#require_once 'lib/mocks/Doctrine_ConnectionMock.php';
#require_once 'lib/mocks/Doctrine_UnitOfWorkMock.php';
#require_once 'lib/mocks/Doctrine_IdentityIdGeneratorMock.php';
/**
* UnitOfWork tests.
*/
...
...
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