@@ 402-409 (lines=8) @@ | ||
399 | * @param object $document The instance to make managed and persistent. |
|
400 | * @throws \InvalidArgumentException When the given $document param is not an object |
|
401 | */ |
|
402 | public function persist($document) |
|
403 | { |
|
404 | if ( ! is_object($document)) { |
|
405 | throw new \InvalidArgumentException(gettype($document)); |
|
406 | } |
|
407 | $this->errorIfClosed(); |
|
408 | $this->unitOfWork->persist($document); |
|
409 | } |
|
410 | ||
411 | /** |
|
412 | * Removes a document instance. |
|
@@ 420-427 (lines=8) @@ | ||
417 | * @param object $document The document instance to remove. |
|
418 | * @throws \InvalidArgumentException when the $document param is not an object |
|
419 | */ |
|
420 | public function remove($document) |
|
421 | { |
|
422 | if ( ! is_object($document)) { |
|
423 | throw new \InvalidArgumentException(gettype($document)); |
|
424 | } |
|
425 | $this->errorIfClosed(); |
|
426 | $this->unitOfWork->remove($document); |
|
427 | } |
|
428 | ||
429 | /** |
|
430 | * Refreshes the persistent state of a document from the database, |
|
@@ 436-443 (lines=8) @@ | ||
433 | * @param object $document The document to refresh. |
|
434 | * @throws \InvalidArgumentException When the given $document param is not an object |
|
435 | */ |
|
436 | public function refresh($document) |
|
437 | { |
|
438 | if ( ! is_object($document)) { |
|
439 | throw new \InvalidArgumentException(gettype($document)); |
|
440 | } |
|
441 | $this->errorIfClosed(); |
|
442 | $this->unitOfWork->refresh($document); |
|
443 | } |
|
444 | ||
445 | /** |
|
446 | * Detaches a document from the DocumentManager, causing a managed document to |
|
@@ 473-480 (lines=8) @@ | ||
470 | * @throws \InvalidArgumentException if the $document param is not an object |
|
471 | * @return object The managed copy of the document. |
|
472 | */ |
|
473 | public function merge($document) |
|
474 | { |
|
475 | if ( ! is_object($document)) { |
|
476 | throw new \InvalidArgumentException(gettype($document)); |
|
477 | } |
|
478 | $this->errorIfClosed(); |
|
479 | return $this->unitOfWork->merge($document); |
|
480 | } |
|
481 | ||
482 | /** |
|
483 | * Acquire a lock on the given document. |