public function save(EntityInterface $entity) { /** @var UserProvider $entity */ $created = $entity->getCreated(); if (is_null($created)) { $entity->setCreated(new \DateTime()); } $entity->setChanged(new \DateTime()); return parent::save($entity); }
public function create(array $data = null) { /** @var ComboDirectoryItem $entity */ $entity = parent::create(); $entity->setFieldList($this->getFieldsList()); if (!is_null($data)) { $this->load($entity, $data); } return $entity; }
public function create(array $data = null, $entityClass = null) { /** @var File $entity */ $entity = parent::create($data, $entityClass); $entity->setRootUri($this->getRootUri()); return $entity; }
public function reserve(EntityInterface $entity) { $data = parent::reserve($entity); $firstField = $this->getFirstFieldName(); $secondField = $this->getSecondFieldName(); $data["fields"][$firstField] = $this->getField($entity, self::FIRST_ENTITY_FIELD); $data["fields"][$secondField] = $this->getField($entity, self::SECOND_ENTITY_FIELD); foreach ($data["fields"] as $field => $value) { if ($value instanceof EntityInterface) { $data["fields"][$field] = $value->getId(); } } return $data; }
public function delete(EntityInterface $entity) { $id = $entity->getId(); $this->clearCategories($id); return parent::delete($entity); }