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
96eaf67e
Commit
96eaf67e
authored
Feb 21, 2010
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0][DDC-350] Fixed. Patch provided by Christian Heinrich.
parent
ac62e4d9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
51 deletions
+86
-51
EntityManager.php
lib/Doctrine/ORM/EntityManager.php
+62
-47
EntityManagerTest.php
tests/Doctrine/Tests/ORM/EntityManagerTest.php
+24
-4
No files found.
lib/Doctrine/ORM/EntityManager.php
View file @
96eaf67e
...
...
@@ -356,10 +356,13 @@ class EntityManager
*
* @param object $object The instance to make managed and persistent.
*/
public
function
persist
(
$
object
)
public
function
persist
(
$
entity
)
{
if
(
!
is_object
(
$entity
))
{
throw
new
\InvalidArgumentException
(
gettype
(
$entity
));
}
$this
->
_errorIfClosed
();
$this
->
_unitOfWork
->
persist
(
$
object
);
$this
->
_unitOfWork
->
persist
(
$
entity
);
}
/**
...
...
@@ -372,6 +375,9 @@ class EntityManager
*/
public
function
remove
(
$entity
)
{
if
(
!
is_object
(
$entity
))
{
throw
new
\InvalidArgumentException
(
gettype
(
$entity
));
}
$this
->
_errorIfClosed
();
$this
->
_unitOfWork
->
remove
(
$entity
);
}
...
...
@@ -384,6 +390,9 @@ class EntityManager
*/
public
function
refresh
(
$entity
)
{
if
(
!
is_object
(
$entity
))
{
throw
new
\InvalidArgumentException
(
gettype
(
$entity
));
}
$this
->
_errorIfClosed
();
$this
->
_unitOfWork
->
refresh
(
$entity
);
}
...
...
@@ -399,6 +408,9 @@ class EntityManager
*/
public
function
detach
(
$entity
)
{
if
(
!
is_object
(
$entity
))
{
throw
new
\InvalidArgumentException
(
gettype
(
$entity
));
}
$this
->
_unitOfWork
->
detach
(
$entity
);
}
...
...
@@ -412,6 +424,9 @@ class EntityManager
*/
public
function
merge
(
$entity
)
{
if
(
!
is_object
(
$entity
))
{
throw
new
\InvalidArgumentException
(
gettype
(
$entity
));
}
$this
->
_errorIfClosed
();
return
$this
->
_unitOfWork
->
merge
(
$entity
);
}
...
...
tests/Doctrine/Tests/ORM/EntityManagerTest.php
View file @
96eaf67e
...
...
@@ -83,6 +83,26 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase
$this
->
assertEquals
(
'SELECT 1'
,
$q
->
getDql
());
}
static
public
function
dataMethodsAffectedByNoObjectArguments
()
{
return
array
(
array
(
'persist'
),
array
(
'remove'
),
array
(
'merge'
),
array
(
'refresh'
),
array
(
'detach'
)
);
}
/**
* @dataProvider dataMethodsAffectedByNoObjectArguments
* @expectedException \InvalidArgumentException
* @param string $methodName
*/
public
function
testThrowsExceptionOnNonObjectValues
(
$methodName
)
{
$this
->
_em
->
$methodName
(
null
);
}
static
public
function
dataAffectedByErrorIfClosedException
()
{
return
array
(
...
...
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