예제 #1
0
파일: Repository.php 프로젝트: deefour/aide
 /**
  * {@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;
 }
예제 #2
0
파일: Repository.php 프로젝트: deefour/aide
 /**
  * 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());
 }