/** * {@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; }
/** * {@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; }
/** * {@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; }
public function dehydrate(AbstractEntity $entity, AbstractProperty $property) { $file = $entity->getAttribute($property->getName()); return $file ? '{filedir_' . $file->upload_location_id . '}' . $file->file_name : null; }
/** * {@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; }
/** * {@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'; } }
/** * {@inheritdoc} */ public function hydrate(AbstractEntity $entity, AbstractProperty $property) { $value = $this->parse($entity->getAttribute($property->getIdentifier())); $entity->setAttribute($property->getName(), $value); return $value; }