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
80de5678
Commit
80de5678
authored
May 03, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Fixed issue in changeset calculation.
parent
ae7be288
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
44 deletions
+58
-44
DriverManager.php
lib/Doctrine/DBAL/DriverManager.php
+1
-1
AbstractEntityPersister.php
lib/Doctrine/ORM/Persisters/AbstractEntityPersister.php
+14
-13
JoinedSubclassPersister.php
lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php
+2
-1
SingleTablePersister.php
lib/Doctrine/ORM/Persisters/SingleTablePersister.php
+30
-19
UnitOfWork.php
lib/Doctrine/ORM/UnitOfWork.php
+4
-4
SingleTableInheritanceTest.php
...trine/Tests/ORM/Functional/SingleTableInheritanceTest.php
+7
-6
No files found.
lib/Doctrine/DBAL/DriverManager.php
View file @
80de5678
...
...
@@ -32,7 +32,7 @@ use Doctrine\Common\EventManager;
final
class
DriverManager
{
/**
* List of supported drivers and their mappings to the driver class.
* List of supported drivers and their mappings to the driver class
es
.
*
* @var array
*/
...
...
lib/Doctrine/ORM/Persisters/AbstractEntityPersister.php
View file @
80de5678
...
...
@@ -87,7 +87,8 @@ abstract class AbstractEntityPersister
* Inserts an entity.
*
* @param object $entity The entity to insert.
* @return mixed
* @return mixed If the entity uses a post-insert ID generator, the generated
* ID is returned, NULL otherwise.
*/
public
function
insert
(
$entity
)
{
...
...
@@ -118,7 +119,7 @@ abstract class AbstractEntityPersister
*/
public
function
executeInserts
()
{
$tableName
=
$this
->
_classMetadata
->
getTableName
();
//
$tableName = $this->_classMetadata->getTableName();
$stmt
=
$this
->
_conn
->
prepare
(
$this
->
_classMetadata
->
getInsertSql
());
foreach
(
$this
->
_queuedInserts
as
$insertData
)
{
$stmt
->
execute
(
array_values
(
$insertData
));
...
...
@@ -154,11 +155,21 @@ abstract class AbstractEntityPersister
$this
->
_conn
->
delete
(
$this
->
_classMetadata
->
getTableName
(),
$id
);
}
/**
* Adds an entity to delete.
*
* @param object $entity
*/
public
function
addDelete
(
$entity
)
{
}
/**
* Executes all pending entity deletions.
*
* @see addDelete()
*/
public
function
executeDeletions
()
{
...
...
@@ -198,21 +209,11 @@ abstract class AbstractEntityPersister
return
array
();
}
/**
* Gets all field mappings of the entire entity hierarchy.
*
* @return array
*/
public
function
getAllFieldMappingsInHierarchy
()
{
return
$this
->
_classMetadata
->
getFieldMappings
();
}
/**
* Prepares the data of an entity for an insert/update operation.
*
* @param object $entity
* @param array $
array
* @param array $
result The reference to the data array.
* @param boolean $isInsert
*/
protected
function
_prepareData
(
$entity
,
array
&
$result
,
$isInsert
=
false
)
...
...
lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php
View file @
80de5678
...
...
@@ -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\Persisters
;
...
...
@@ -30,6 +30,7 @@ namespace Doctrine\ORM\Persisters;
* @version $Revision$
* @link www.doctrine-project.org
* @since 2.0
* @todo Reimplement.
*/
class
JoinedSubclassPersister
extends
AbstractEntityPersister
{
...
...
lib/Doctrine/ORM/Persisters/SingleTablePersister.php
View file @
80de5678
<?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
;
/**
* Persister for entities that participate in a hierarchy mapped with the
* SINGLE_TABLE strategy.
*
* @author Roman Borschel <roman@code-factory.org>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version $Revision: 3406 $
* @link www.doctrine-project.org
* @since 2.0
*/
class
SingleTablePersister
extends
AbstractEntityPersister
{
//private $_selectColumnList = array();
public
function
insert
(
$entity
)
{
return
parent
::
insert
(
$entity
);
...
...
@@ -18,23 +45,7 @@ class SingleTablePersister extends AbstractEntityPersister
// Populate the discriminator column
if
(
$isInsert
)
{
$discColumn
=
$this
->
_classMetadata
->
getDiscriminatorColumn
();
//$discMap = $this->_classMetadata->getDiscriminatorMap();
$result
[
$discColumn
[
'name'
]]
=
$this
->
_classMetadata
->
getDiscriminatorValue
();
//array_search($this->_entityName, $discMap);
}
$result
[
$discColumn
[
'name'
]]
=
$this
->
_classMetadata
->
getDiscriminatorValue
();
}
/**
* {@inheritdoc}
*/
/*public function getAllFieldMappingsInHierarchy()
{
$fieldMappings = $this->_classMetadata->getFieldMappings();
foreach ($this->_classMetadata->getSubclasses() as $subclassName) {
$fieldMappings = array_merge(
$fieldMappings,
$this->_em->getClassMetadata($subclassName)->getFieldMappings()
);
}
return $fieldMappings;
}*/
}
\ No newline at end of file
lib/Doctrine/ORM/UnitOfWork.php
View file @
80de5678
...
...
@@ -325,14 +325,14 @@ class UnitOfWork implements PropertyChangedListener
$entitiesToProcess
=
$class
->
isChangeTrackingDeferredExplicit
()
?
$this
->
_scheduledForDirtyCheck
[
$className
]
:
$entities
;
if
(
!
$class
->
isInheritanceTypeNone
()
&&
count
(
$entitiesToProcess
)
>
0
)
{
$class
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entitiesToProcess
[
key
(
$entitiesToProcess
)]));
}
foreach
(
$entitiesToProcess
as
$entity
)
{
$oid
=
spl_object_hash
(
$entity
);
$state
=
$this
->
getEntityState
(
$entity
);
if
(
!
$class
->
isInheritanceTypeNone
())
{
$class
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
}
// Look for changes in the entity itself by comparing against the
// original data we have.
if
(
$state
==
self
::
STATE_MANAGED
||
$state
==
self
::
STATE_NEW
)
{
...
...
tests/Doctrine/Tests/ORM/Functional/SingleTableInheritanceTest.php
View file @
80de5678
...
...
@@ -28,18 +28,19 @@ class SingleTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this
->
_em
->
save
(
$parent
);
$relatedEntity
=
new
RelatedEntity
;
$relatedEntity
->
setName
(
'theRelatedOne'
);
$this
->
_em
->
save
(
$relatedEntity
);
$child
=
new
ChildEntity
;
$child
->
setData
(
'thedata'
);
$child
->
setNumber
(
1234
);
$child
->
setRelatedEntity
(
$relatedEntity
);
//
$child->setRelatedEntity($relatedEntity);
$this
->
_em
->
save
(
$child
);
$relatedEntity
=
new
RelatedEntity
;
$relatedEntity
->
setName
(
'theRelatedOne'
);
$relatedEntity
->
setOwner
(
$child
);
$this
->
_em
->
save
(
$relatedEntity
);
$this
->
_em
->
flush
();
$this
->
_em
->
clear
();
...
...
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