@@ 385-392 (lines=8) @@ | ||
382 | * @param object $document The instance to make managed and persistent. |
|
383 | * @throws \InvalidArgumentException When the given $document param is not an object |
|
384 | */ |
|
385 | public function persist($document) |
|
386 | { |
|
387 | if ( ! is_object($document)) { |
|
388 | throw new \InvalidArgumentException(gettype($document)); |
|
389 | } |
|
390 | $this->errorIfClosed(); |
|
391 | $this->unitOfWork->persist($document); |
|
392 | } |
|
393 | ||
394 | /** |
|
395 | * Removes a document instance. |
|
@@ 403-410 (lines=8) @@ | ||
400 | * @param object $document The document instance to remove. |
|
401 | * @throws \InvalidArgumentException when the $document param is not an object |
|
402 | */ |
|
403 | public function remove($document) |
|
404 | { |
|
405 | if ( ! is_object($document)) { |
|
406 | throw new \InvalidArgumentException(gettype($document)); |
|
407 | } |
|
408 | $this->errorIfClosed(); |
|
409 | $this->unitOfWork->remove($document); |
|
410 | } |
|
411 | ||
412 | /** |
|
413 | * Refreshes the persistent state of a document from the database, |
|
@@ 419-426 (lines=8) @@ | ||
416 | * @param object $document The document to refresh. |
|
417 | * @throws \InvalidArgumentException When the given $document param is not an object |
|
418 | */ |
|
419 | public function refresh($document) |
|
420 | { |
|
421 | if ( ! is_object($document)) { |
|
422 | throw new \InvalidArgumentException(gettype($document)); |
|
423 | } |
|
424 | $this->errorIfClosed(); |
|
425 | $this->unitOfWork->refresh($document); |
|
426 | } |
|
427 | ||
428 | /** |
|
429 | * Detaches a document from the DocumentManager, causing a managed document to |
|
@@ 456-463 (lines=8) @@ | ||
453 | * @throws \InvalidArgumentException if the $document param is not an object |
|
454 | * @return object The managed copy of the document. |
|
455 | */ |
|
456 | public function merge($document) |
|
457 | { |
|
458 | if ( ! is_object($document)) { |
|
459 | throw new \InvalidArgumentException(gettype($document)); |
|
460 | } |
|
461 | $this->errorIfClosed(); |
|
462 | return $this->unitOfWork->merge($document); |
|
463 | } |
|
464 | ||
465 | /** |
|
466 | * Acquire a lock on the given document. |