@@ 406-413 (lines=8) @@ | ||
403 | * @param object $document The instance to make managed and persistent. |
|
404 | * @throws \InvalidArgumentException When the given $document param is not an object |
|
405 | */ |
|
406 | public function persist($document) |
|
407 | { |
|
408 | if ( ! is_object($document)) { |
|
409 | throw new \InvalidArgumentException(gettype($document)); |
|
410 | } |
|
411 | $this->errorIfClosed(); |
|
412 | $this->unitOfWork->persist($document); |
|
413 | } |
|
414 | ||
415 | /** |
|
416 | * Removes a document instance. |
|
@@ 424-431 (lines=8) @@ | ||
421 | * @param object $document The document instance to remove. |
|
422 | * @throws \InvalidArgumentException when the $document param is not an object |
|
423 | */ |
|
424 | public function remove($document) |
|
425 | { |
|
426 | if ( ! is_object($document)) { |
|
427 | throw new \InvalidArgumentException(gettype($document)); |
|
428 | } |
|
429 | $this->errorIfClosed(); |
|
430 | $this->unitOfWork->remove($document); |
|
431 | } |
|
432 | ||
433 | /** |
|
434 | * Refreshes the persistent state of a document from the database, |
|
@@ 440-447 (lines=8) @@ | ||
437 | * @param object $document The document to refresh. |
|
438 | * @throws \InvalidArgumentException When the given $document param is not an object |
|
439 | */ |
|
440 | public function refresh($document) |
|
441 | { |
|
442 | if ( ! is_object($document)) { |
|
443 | throw new \InvalidArgumentException(gettype($document)); |
|
444 | } |
|
445 | $this->errorIfClosed(); |
|
446 | $this->unitOfWork->refresh($document); |
|
447 | } |
|
448 | ||
449 | /** |
|
450 | * Detaches a document from the DocumentManager, causing a managed document to |
|
@@ 477-484 (lines=8) @@ | ||
474 | * @throws \InvalidArgumentException if the $document param is not an object |
|
475 | * @return object The managed copy of the document. |
|
476 | */ |
|
477 | public function merge($document) |
|
478 | { |
|
479 | if ( ! is_object($document)) { |
|
480 | throw new \InvalidArgumentException(gettype($document)); |
|
481 | } |
|
482 | $this->errorIfClosed(); |
|
483 | return $this->unitOfWork->merge($document); |
|
484 | } |
|
485 | ||
486 | /** |
|
487 | * Acquire a lock on the given document. |