@@ 392-399 (lines=8) @@ | ||
389 | * @param object $document The instance to make managed and persistent. |
|
390 | * @throws \InvalidArgumentException When the given $document param is not an object |
|
391 | */ |
|
392 | public function persist($document) |
|
393 | { |
|
394 | if ( ! is_object($document)) { |
|
395 | throw new \InvalidArgumentException(gettype($document)); |
|
396 | } |
|
397 | $this->errorIfClosed(); |
|
398 | $this->unitOfWork->persist($document); |
|
399 | } |
|
400 | ||
401 | /** |
|
402 | * Removes a document instance. |
|
@@ 410-417 (lines=8) @@ | ||
407 | * @param object $document The document instance to remove. |
|
408 | * @throws \InvalidArgumentException when the $document param is not an object |
|
409 | */ |
|
410 | public function remove($document) |
|
411 | { |
|
412 | if ( ! is_object($document)) { |
|
413 | throw new \InvalidArgumentException(gettype($document)); |
|
414 | } |
|
415 | $this->errorIfClosed(); |
|
416 | $this->unitOfWork->remove($document); |
|
417 | } |
|
418 | ||
419 | /** |
|
420 | * Refreshes the persistent state of a document from the database, |
|
@@ 426-433 (lines=8) @@ | ||
423 | * @param object $document The document to refresh. |
|
424 | * @throws \InvalidArgumentException When the given $document param is not an object |
|
425 | */ |
|
426 | public function refresh($document) |
|
427 | { |
|
428 | if ( ! is_object($document)) { |
|
429 | throw new \InvalidArgumentException(gettype($document)); |
|
430 | } |
|
431 | $this->errorIfClosed(); |
|
432 | $this->unitOfWork->refresh($document); |
|
433 | } |
|
434 | ||
435 | /** |
|
436 | * Detaches a document from the DocumentManager, causing a managed document to |
|
@@ 463-470 (lines=8) @@ | ||
460 | * @throws \InvalidArgumentException if the $document param is not an object |
|
461 | * @return object The managed copy of the document. |
|
462 | */ |
|
463 | public function merge($document) |
|
464 | { |
|
465 | if ( ! is_object($document)) { |
|
466 | throw new \InvalidArgumentException(gettype($document)); |
|
467 | } |
|
468 | $this->errorIfClosed(); |
|
469 | return $this->unitOfWork->merge($document); |
|
470 | } |
|
471 | ||
472 | /** |
|
473 | * Acquire a lock on the given document. |