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
22375235
Commit
22375235
authored
Dec 02, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0][DDC-162][DDC-94] Fixed.
parent
69a0b597
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
12 deletions
+55
-12
StandardEntityPersister.php
lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
+54
-10
ObjectHydratorTest.php
tests/Doctrine/Tests/ORM/Hydration/ObjectHydratorTest.php
+1
-2
No files found.
lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
View file @
22375235
...
@@ -73,6 +73,13 @@ class StandardEntityPersister
...
@@ -73,6 +73,13 @@ class StandardEntityPersister
*/
*/
protected
$_em
;
protected
$_em
;
/**
* The SqlLogger to use, if any.
*
* @var Doctrine\DBAL\Logging\SqlLogger
*/
protected
$_sqlLogger
;
/**
/**
* Queued inserts.
* Queued inserts.
*
*
...
@@ -92,6 +99,7 @@ class StandardEntityPersister
...
@@ -92,6 +99,7 @@ class StandardEntityPersister
{
{
$this
->
_em
=
$em
;
$this
->
_em
=
$em
;
$this
->
_conn
=
$em
->
getConnection
();
$this
->
_conn
=
$em
->
getConnection
();
$this
->
_sqlLogger
=
$em
->
getConfiguration
()
->
getSqlLogger
();
$this
->
_platform
=
$this
->
_conn
->
getDatabasePlatform
();
$this
->
_platform
=
$this
->
_conn
->
getDatabasePlatform
();
$this
->
_class
=
$class
;
$this
->
_class
=
$class
;
}
}
...
@@ -405,8 +413,15 @@ class StandardEntityPersister
...
@@ -405,8 +413,15 @@ class StandardEntityPersister
*/
*/
public
function
load
(
array
$criteria
,
$entity
=
null
,
$assoc
=
null
,
array
$hints
=
array
())
public
function
load
(
array
$criteria
,
$entity
=
null
,
$assoc
=
null
,
array
$hints
=
array
())
{
{
$stmt
=
$this
->
_conn
->
prepare
(
$this
->
_getSelectEntitiesSql
(
$criteria
,
$assoc
));
$sql
=
$this
->
_getSelectEntitiesSql
(
$criteria
,
$assoc
);
$stmt
->
execute
(
array_values
(
$criteria
));
$params
=
array_values
(
$criteria
);
if
(
$this
->
_sqlLogger
!==
null
)
{
$this
->
_sqlLogger
->
logSql
(
$sql
,
$params
);
}
$stmt
=
$this
->
_conn
->
prepare
(
$sql
);
$stmt
->
execute
(
$params
);
$result
=
$stmt
->
fetch
(
Connection
::
FETCH_ASSOC
);
$result
=
$stmt
->
fetch
(
Connection
::
FETCH_ASSOC
);
$stmt
->
closeCursor
();
$stmt
->
closeCursor
();
...
@@ -421,8 +436,15 @@ class StandardEntityPersister
...
@@ -421,8 +436,15 @@ class StandardEntityPersister
*/
*/
final
public
function
refresh
(
array
$id
,
$entity
)
final
public
function
refresh
(
array
$id
,
$entity
)
{
{
$stmt
=
$this
->
_conn
->
prepare
(
$this
->
_getSelectEntitiesSql
(
$id
));
$sql
=
$this
->
_getSelectEntitiesSql
(
$id
);
$stmt
->
execute
(
array_values
(
$id
));
$params
=
array_values
(
$id
);
if
(
$this
->
_sqlLogger
!==
null
)
{
$this
->
_sqlLogger
->
logSql
(
$sql
,
$params
);
}
$stmt
=
$this
->
_conn
->
prepare
(
$sql
);
$stmt
->
execute
(
$params
);
$result
=
$stmt
->
fetch
(
Connection
::
FETCH_ASSOC
);
$result
=
$stmt
->
fetch
(
Connection
::
FETCH_ASSOC
);
$stmt
->
closeCursor
();
$stmt
->
closeCursor
();
...
@@ -503,8 +525,15 @@ class StandardEntityPersister
...
@@ -503,8 +525,15 @@ class StandardEntityPersister
{
{
$entities
=
array
();
$entities
=
array
();
$stmt
=
$this
->
_conn
->
prepare
(
$this
->
_getSelectEntitiesSql
(
$criteria
));
$sql
=
$this
->
_getSelectEntitiesSql
(
$criteria
);
$stmt
->
execute
(
array_values
(
$criteria
));
$params
=
array_values
(
$criteria
);
if
(
$this
->
_sqlLogger
!==
null
)
{
$this
->
_sqlLogger
->
logSql
(
$sql
,
$params
);
}
$stmt
=
$this
->
_conn
->
prepare
(
$sql
);
$stmt
->
execute
(
$params
);
$result
=
$stmt
->
fetchAll
(
Connection
::
FETCH_ASSOC
);
$result
=
$stmt
->
fetchAll
(
Connection
::
FETCH_ASSOC
);
$stmt
->
closeCursor
();
$stmt
->
closeCursor
();
...
@@ -524,8 +553,16 @@ class StandardEntityPersister
...
@@ -524,8 +553,16 @@ class StandardEntityPersister
public
function
loadOneToManyCollection
(
array
$criteria
,
PersistentCollection
$coll
)
public
function
loadOneToManyCollection
(
array
$criteria
,
PersistentCollection
$coll
)
{
{
$owningAssoc
=
$this
->
_class
->
associationMappings
[
$coll
->
getMapping
()
->
mappedByFieldName
];
$owningAssoc
=
$this
->
_class
->
associationMappings
[
$coll
->
getMapping
()
->
mappedByFieldName
];
$stmt
=
$this
->
_conn
->
prepare
(
$this
->
_getSelectEntitiesSql
(
$criteria
,
$owningAssoc
));
$stmt
->
execute
(
array_values
(
$criteria
));
$sql
=
$this
->
_getSelectEntitiesSql
(
$criteria
,
$owningAssoc
);
$params
=
array_values
(
$criteria
);
if
(
$this
->
_sqlLogger
!==
null
)
{
$this
->
_sqlLogger
->
logSql
(
$sql
,
$params
);
}
$stmt
=
$this
->
_conn
->
prepare
(
$sql
);
$stmt
->
execute
(
$params
);
while
(
$result
=
$stmt
->
fetch
(
Connection
::
FETCH_ASSOC
))
{
while
(
$result
=
$stmt
->
fetch
(
Connection
::
FETCH_ASSOC
))
{
$coll
->
hydrateAdd
(
$this
->
_createEntity
(
$result
));
$coll
->
hydrateAdd
(
$this
->
_createEntity
(
$result
));
}
}
...
@@ -540,8 +577,15 @@ class StandardEntityPersister
...
@@ -540,8 +577,15 @@ class StandardEntityPersister
*/
*/
public
function
loadManyToManyCollection
(
$assoc
,
array
$criteria
,
PersistentCollection
$coll
)
public
function
loadManyToManyCollection
(
$assoc
,
array
$criteria
,
PersistentCollection
$coll
)
{
{
$stmt
=
$this
->
_conn
->
prepare
(
$this
->
_getSelectManyToManyEntityCollectionSql
(
$assoc
,
$criteria
));
$sql
=
$this
->
_getSelectManyToManyEntityCollectionSql
(
$assoc
,
$criteria
);
$stmt
->
execute
(
array_values
(
$criteria
));
$params
=
array_values
(
$criteria
);
if
(
$this
->
_sqlLogger
!==
null
)
{
$this
->
_sqlLogger
->
logSql
(
$sql
,
$params
);
}
$stmt
=
$this
->
_conn
->
prepare
(
$sql
);
$stmt
->
execute
(
$params
);
while
(
$result
=
$stmt
->
fetch
(
Connection
::
FETCH_ASSOC
))
{
while
(
$result
=
$stmt
->
fetch
(
Connection
::
FETCH_ASSOC
))
{
$coll
->
hydrateAdd
(
$this
->
_createEntity
(
$result
));
$coll
->
hydrateAdd
(
$this
->
_createEntity
(
$result
));
}
}
...
...
tests/Doctrine/Tests/ORM/Hydration/ObjectHydratorTest.php
View file @
22375235
...
@@ -603,8 +603,7 @@ class ObjectHydratorTest extends HydrationTestCase
...
@@ -603,8 +603,7 @@ class ObjectHydratorTest extends HydrationTestCase
* in the result set.
* in the result set.
*
*
* DQL:
* DQL:
* select c.id, c.position, c.name, b.id, b.position
* select c, b from Doctrine\Tests\Models\Forum\ForumCategory c inner join c.boards b
* from \Doctrine\Tests\Models\Forum\ForumCategory c inner join c.boards b
* order by c.position asc, b.position asc
* order by c.position asc, b.position asc
*
*
* Checks whether the boards are correctly assigned to the categories.
* Checks whether the boards are correctly assigned to the categories.
...
...
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