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