Permalink
Browse files

fixed faulty changes form previous commit

  • Loading branch information...
1 parent 688fda8 commit 0fc2aa4d602225dda496c330062453a21eb9e58f @lsmith77 lsmith77 committed Sep 5, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/Doctrine/ODM/PHPCR/UnitOfWork.php
@@ -238,6 +238,12 @@ public function createDocument($documentName, $node, array &$hints = array())
}
}
+ if (count($refNodeUUIDs) > 0) {
+ $session = $this->dm->getPhpcrSession();
+ // ensure that the given nodes are in the in memory cache
+ $session->getNodesByIdentifier($refNodeUUIDs);
+ }
+
// initialize inverse side collections
foreach ($class->associationsMappings as $assocName => $assocOptions) {
if ($assocOptions['type'] & ClassMetadata::MANY_TO_ONE) {
@@ -824,7 +830,7 @@ public function flush($persist_to_backend = true)
if (isset($class->fieldMappings[$fieldName])) {
$type = \PHPCR\PropertyType::valueFromName($class->fieldMappings[$fieldName]['type']);
if ($class->fieldMappings[$fieldName]['multivalue']) {
- $value = $fieldValue ?: $fieldValue->toArray();
+ $value = $fieldValue === null ? null : $fieldValue->toArray();
$node->setProperty($class->fieldMappings[$fieldName]['name'], $value, $type);
} else {
$node->setProperty($class->fieldMappings[$fieldName]['name'], $fieldValue, $type);
@@ -856,7 +862,7 @@ public function flush($persist_to_backend = true)
if (isset($class->fieldMappings[$fieldName])) {
$type = \PHPCR\PropertyType::valueFromName($class->fieldMappings[$fieldName]['type']);
if ($class->fieldMappings[$fieldName]['multivalue']) {
- $value = $fieldValue ?: $fieldValue->toArray();
+ $value = $fieldValue === null ? null : $fieldValue->toArray();
$node->setProperty($class->fieldMappings[$fieldName]['name'], $value, $type);
} else {
$node->setProperty($class->fieldMappings[$fieldName]['name'], $fieldValue, $type);

0 comments on commit 0fc2aa4

Please sign in to comment.