|
@@ 1480-1489 (lines=10) @@
|
| 1477 |
|
* @return object |
| 1478 |
|
* @throws InvalidArgumentException if the class does not have an identifier |
| 1479 |
|
*/ |
| 1480 |
|
public function getById($id, ClassMetadata $class) |
| 1481 |
|
{ |
| 1482 |
|
if ( ! $class->identifier) { |
| 1483 |
|
throw new \InvalidArgumentException(sprintf('Class "%s" does not have an identifier', $class->name)); |
| 1484 |
|
} |
| 1485 |
|
|
| 1486 |
|
$serializedId = serialize($class->getDatabaseIdentifierValue($id)); |
| 1487 |
|
|
| 1488 |
|
return $this->identityMap[$class->name][$serializedId]; |
| 1489 |
|
} |
| 1490 |
|
|
| 1491 |
|
/** |
| 1492 |
|
* INTERNAL: |
|
@@ 1502-1511 (lines=10) @@
|
| 1499 |
|
* @return mixed The found document or FALSE. |
| 1500 |
|
* @throws InvalidArgumentException if the class does not have an identifier |
| 1501 |
|
*/ |
| 1502 |
|
public function tryGetById($id, ClassMetadata $class) |
| 1503 |
|
{ |
| 1504 |
|
if ( ! $class->identifier) { |
| 1505 |
|
throw new \InvalidArgumentException(sprintf('Class "%s" does not have an identifier', $class->name)); |
| 1506 |
|
} |
| 1507 |
|
|
| 1508 |
|
$serializedId = serialize($class->getDatabaseIdentifierValue($id)); |
| 1509 |
|
|
| 1510 |
|
return $this->identityMap[$class->name][$serializedId] ?? false; |
| 1511 |
|
} |
| 1512 |
|
|
| 1513 |
|
/** |
| 1514 |
|
* Schedules a document for dirty-checking at commit-time. |