本文整理匯總了PHP中Doctrine\ODM\PHPCR\DocumentManager::findMany方法的典型用法代碼示例。如果您正苦於以下問題:PHP DocumentManager::findMany方法的具體用法?PHP DocumentManager::findMany怎麽用?PHP DocumentManager::findMany使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\ODM\PHPCR\DocumentManager
的用法示例。
在下文中一共展示了DocumentManager::findMany方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testFindByUUID
public function testFindByUUID()
{
$refTestObj = new RefRefTestObj();
$refTestObj->id = "/functional/refRefTestObj";
$refTestObj->name = 'referrer';
$this->dm->persist($refTestObj);
$this->dm->flush();
$this->dm->clear();
$node = $this->session->getNode($refTestObj->id);
$document = $this->dm->find($this->referencedType, $node->getIdentifier());
$this->assertInstanceOf($this->referencedType, $document);
$documents = $this->dm->findMany($this->referencedType, array($node->getIdentifier()));
$this->assertInstanceOf($this->referencedType, $documents->first());
}
示例2: testFetchingMultipleHierarchicalObjectsWithChildIdFirst
public function testFetchingMultipleHierarchicalObjectsWithChildIdFirst()
{
$parent = new ParentTestObj();
$parent->nodename = 'parent';
$parent->name = 'parent';
$parent->parent = $this->dm->find(null, 'functional');
$child = new ParentTestObj();
$child->nodename = 'child';
$child->name = 'child';
$child->parent = $parent;
$this->dm->persist($parent);
$this->dm->persist($child);
$parentId = $this->uow->getDocumentId($parent);
$childId = $this->uow->getDocumentId($child);
$this->dm->flush();
$this->dm->clear();
// this forces the objects to be loaded in an order where the $parent will become a proxy
$documents = $this->dm->findMany('Doctrine\\Tests\\Models\\References\\ParentTestObj', array($childId, $parentId));
$this->assertCount(2, $documents);
/* @var $child ParentTestObj */
/* @var $parent ParentTestObj */
$child = $documents->first();
$parent = $documents->last();
$this->assertSame($child->parent, $parent);
$this->assertSame('parent', $parent->nodename);
}
示例3: testFindManyWithNonExistingUuuid
public function testFindManyWithNonExistingUuuid()
{
$user = new TestUser();
$user->username = 'test-name';
$user->id = '/functional/test';
$this->dm->persist($user);
$this->dm->flush();
$this->dm->clear();
$actualUuid = $user->uuid;
$unusedUuid = UUIDHelper::generateUUID();
$this->assertNotNull($this->dm->find(get_class($user), $user->id));
$this->assertNotNull($this->dm->find(get_class($user), $actualUuid));
$this->assertNull($this->dm->find(get_class($user), $unusedUuid));
$uuids = array($actualUuid, $unusedUuid);
$documents = $this->dm->findMany(get_class($user), $uuids);
$this->assertEquals(1, count($documents));
}
示例4: find
/**
* @param string $path
*
* @return \Imagine\Image\ImageInterface
*/
public function find($path)
{
$file = $this->rootPath . '/' . ltrim($path, '/');
$info = $this->getFileInfo($file);
$name = $info['dirname'] . '/' . $info['filename'];
// consider full path as provided (with or without an extension)
$paths = array($file);
foreach ($this->formats as $format) {
// consider all possible alternative extensions
if (empty($info['extension']) || $info['extension'] !== $format) {
$paths[] = $name . '.' . $format;
}
}
// if the full path contained an extension, also consider the full path without an extension
if ($file !== $name) {
$paths[] = $name;
}
$images = $this->manager->findMany($this->class, $paths);
if (!$images->count()) {
throw new NotFoundHttpException(sprintf('Source image not found with id "%s"', $path));
}
return $this->imagine->load(stream_get_contents($this->getStreamFromImage($images->first())));
}
示例5: findMany
/**
* Find many document by id
*
* The ids may either be PHPCR paths or UUID's, but all must be of the same type
*
* @param array $ids document ids
* @return array of document objects
*/
public function findMany(array $ids)
{
return $this->dm->findMany($this->className, $ids);
}
示例6: testManyNotInstanceOf
/**
* TypeTeamUser is not a superclass of User
*/
public function testManyNotInstanceOf()
{
$users = $this->dm->findMany('Doctrine\\Tests\\ODM\\PHPCR\\Functional\\TypeTeamUser', array('/functional/user'));
$this->assertCount(0, $users);
}