/** * {@inheritdoc} */ public function update(EntityInterface $entity, array $options = []) { $model = $entity; if (!$entity instanceof ModelInterface) { $model = $this->model->newInstance($entity->getAttributes(), true); } if (!$model->save($options)) { return false; } $entity->setAttributes($model->getAttributes()); return true; }
/** * Stores all record info to the storage backend and updates the passed entity * object with data from the model being persisted. * * @param \Deefour\Aide\Persistence\Entity\EntityInterface $entity * @param \Deefour\Aide\Persistence\Model\Csv\Model $model * @return void */ protected function persist(EntityInterface $entity, Model $model) { $this->save(); $entity->fromArray($model->toArray()); }