示例#1
0
 /**
  * {@inheritdoc}
  */
 public function hydrate(AbstractEntity $entity, AbstractProperty $property)
 {
     $value = isset($this->entries[$entity->getId()]) ? $this->entries[$entity->getId()] : array();
     $value = $this->relationshipCollection->createChildCollection($entries);
     $entity->setAttribute($property->getName(), $value);
     return $value;
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function hydrate(AbstractEntity $entity, AbstractProperty $property)
 {
     $value = $entity->getAttribute($property->getIdentifier());
     $value = $value ? explode("|", $value) : null;
     $entity->setAttribute($property->getName(), $value);
     return $value;
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 public function hydrate(AbstractEntity $entity, AbstractProperty $property)
 {
     $value = $entity->getAttribute($property->getIdentifier());
     $value = $value ? Carbon::createFromFormat('U', $value) : null;
     $entity->setAttribute($property->getName(), $value);
     return $value;
 }
示例#4
0
 public function dehydrate(AbstractEntity $entity, AbstractProperty $property)
 {
     $file = $entity->getAttribute($property->getName());
     return $file ? '{filedir_' . $file->upload_location_id . '}' . $file->file_name : null;
 }
示例#5
0
 /**
  * {@inheritdoc}
  */
 public function hydrate(AbstractEntity $entity, AbstractProperty $property)
 {
     $value = isset($this->sortedRows[$entity->getId()][$property->getId()]) ? $this->sortedRows[$entity->getId()][$property->getId()] : new GridRowCollection();
     $entity->setAttribute($property->getName(), $value);
     return $value;
 }
示例#6
0
 /**
  * {@inheritdoc}
  */
 public function dehydrate(AbstractEntity $entity, AbstractProperty $property)
 {
     $assets = $entity->getAttribute($property->getName());
     // drop old relations
     $this->db->table('assets_selections')->where($property->getPrefix() . '_id', $property->getId())->where($entity->getPrefix() . '_id', $entity->getId())->delete();
     if ($assets) {
         foreach ($assets as $asset) {
             /*
             $this->db->table('assets_selections')
                 ->insert([
                     $property->getPrefix().'_id' => $property->getId(),
                     $entity->getPrefix().'_id' => $entity->getId(),
                     $asset->file_id,
                 ]
             */
         }
         return '1';
     }
 }
示例#7
0
 /**
  * {@inheritdoc}
  */
 public function hydrate(AbstractEntity $entity, AbstractProperty $property)
 {
     $value = $this->parse($entity->getAttribute($property->getIdentifier()));
     $entity->setAttribute($property->getName(), $value);
     return $value;
 }