Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  * @return Bpi\ApiBundle\Domain\Aggregate\Params
  */
 public function extract()
 {
     $entity = $this->doc->getEntity('params');
     $params = new DomainParams();
     $params->add(new Editable($entity->property('editable')->getValue()));
     $params->add(new Authorship($entity->property('authorship')->getValue()));
     return $params;
 }
Ejemplo n.º 2
0
 /**
  *
  * {@inheritdoc}
  * @return \Bpi\ApiBundle\Domain\Entity\Author
  */
 public function extract()
 {
     $author = $this->doc->getEntity('author');
     $firstname = $author->hasProperty('firstname') ? $author->property('firstname')->getValue() : null;
     $lastname = $author->hasProperty('lastname') ? $author->property('lastname')->getValue() : null;
     if (is_null($lastname) && !is_null($firstname)) {
         $lastname = $firstname;
         unset($firstname);
     }
     return new DomainAuthor(new AgencyId($author->property('agency_id')->getValue()), $author->property('local_id')->getValue(), $lastname, $firstname);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  * @return Bpi\ApiBundle\Domain\Factory\ResourceBuilder
  */
 public function extract()
 {
     $entity = $this->doc->getEntity('resource');
     $builder = new ResourceBuilder();
     $fs = new Filesystem(new MemoryAdapter());
     $entity->walk(function ($e) use($builder, $fs) {
         if ($e->typeOf(Property::TYPE_ASSET)) {
             $file = new File($e->getName(), $fs);
             $file->setContent($e->getValue());
             $builder->addFile($file);
         }
     });
     return $builder->title($entity->property('title')->getValue())->body($entity->property('body')->getValue())->teaser($entity->property('teaser')->getValue())->ctime(new \DateTime($entity->property('ctime')->getValue()));
 }
Ejemplo n.º 4
0
 /**
  *
  * {@inheritdoc}
  * @return DomainProfile
  */
 public function extract()
 {
     $entity = $this->doc->getEntity('profile');
     $builder = new Builder();
     $builder->audience(new Audience($entity->property('audience')->getValue()))->category(new Category($entity->property('category')->getValue()));
     // optional yearwheel property
     if ($entity->hasProperty('yearwheel')) {
         $builder->yearwheel(new Yearwheel($entity->property('yearwheel')->getValue()));
     }
     // optional tags property
     if ($entity->hasProperty('tags')) {
         $builder->tags($entity->property('tags')->getValue());
     }
     return $builder->build();
 }