Ejemplo n.º 1
0
 public function testCantSetCursorOnForeignEntity()
 {
     $doc = new Document();
     $doc->appendEntity($doc->createEntity('bar'));
     $doc2 = new Document();
     $foo = $doc2->createEntity('foo');
     $doc->setCursorOnEntity($foo);
     $this->assertNotEquals(spl_object_hash($foo), spl_object_hash($doc->currentEntity()));
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function transform(Document $document)
 {
     $entity = $document->createEntity('entity');
     $entity->addProperty($document->createProperty('id', 'string', $this->getId()));
     $entity->addProperty($document->createProperty('pushed', 'dateTime', $this->ctime));
     $entity->addProperty($document->createProperty('editable', 'boolean', (int) $this->params->filter(function ($e) {
         if ($e instanceof Editable) {
             return true;
         }
     })->first()->isPositive()));
     $document->appendEntity($entity);
     $document->setCursorOnEntity($entity);
     $this->author->transform($document);
     $entity->addProperty($document->createProperty('category', 'string', $this->getCategory()->getCategory()));
     $entity->addProperty($document->createProperty('audience', 'string', $this->getAudience()->getAudience()));
     $entity->addProperty($document->createProperty('syndications', 'string', null === $this->getSyndications() ? 0 : $this->getSyndications()));
     $this->profile->transform($document);
     $this->resource->transform($document);
 }