public function testMoveWithoutAdmin()
 {
     $movedPath = '/cms/to-move';
     $targetPath = '/cms/target/moved';
     $urlSafeId = 'urlSafeId';
     $this->defaultModelManager->expects($this->once())->method('getNormalizedIdentifier')->will($this->returnValue($targetPath));
     $this->defaultModelManager->expects($this->once())->method('getUrlsafeIdentifier')->will($this->returnValue($urlSafeId));
     $this->pool->expects($this->once())->method('getAdminByClass')->will($this->returnValue(null));
     $tree = new PhpcrOdmTree($this->dm, $this->defaultModelManager, $this->pool, $this->translator, $this->assetHelper, array(), array('depth' => 1, 'precise_children' => true));
     $this->assertEquals(array('id' => $targetPath, 'url_safe_id' => $urlSafeId), $tree->move($movedPath, $targetPath));
 }
 /**
  * @param ModelManager $manager the manager to use with this document
  * @param object $document      the PHPCR-ODM document to get the children of
  *
  * @return array of children indexed by child nodename pointing to the child documents
  */
 private function getDocumentChildren(ModelManager $manager, $document)
 {
     $accessor = PropertyAccess::getPropertyAccessor();
     // use deprecated BC method to support symfony 2.2
     /** @var $meta \Doctrine\ODM\PHPCR\Mapping\ClassMetadata */
     $meta = $manager->getMetadata(ClassUtils::getClass($document));
     $children = array();
     foreach ($meta->childrenMappings as $fieldName) {
         try {
             $prop = $accessor->getValue($document, $fieldName);
         } catch (NoSuchPropertyException $e) {
             $prop = $meta->getReflectionProperty($fieldName)->getValue($document);
         }
         if (null === $prop) {
             continue;
         }
         if (!is_array($prop)) {
             $prop = $prop->toArray();
         }
         $children = array_merge($children, $this->filterDocumentChildren($document, $prop));
     }
     foreach ($meta->childMappings as $fieldName) {
         try {
             $prop = $accessor->getValue($document, $fieldName);
         } catch (NoSuchPropertyException $e) {
             $prop = $meta->getReflectionProperty($fieldName)->getValue($document);
         }
         if (null !== $prop && $this->isValidDocumentChild($document, $prop)) {
             $children[$fieldName] = $prop;
         }
     }
     return $children;
 }