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