Exemplo n.º 1
0
 /**
  * @param ModelInterface $article
  * @param array $post
  * @param Form $form
  * @return int
  */
 public function edit(ModelInterface $article, array $post, Form $form = null)
 {
     $article->setDateModified();
     $result = parent::edit($article, $post);
     // find page first, if exists delete it before updating.
     if (!$result instanceof Form) {
         $pageResult = $this->updateMenuItem($this->getById($article->getArticleId()), $post);
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Hydrate $object with the provided $data.
  *
  * @param  array $data
  * @param  ModelInterface $object
  * @return object
  */
 public function hydrate(array $data, $object)
 {
     foreach ($data as $key => $value) {
         $hydrateName = $this->hydrateName($key);
         if ($object->has($hydrateName)) {
             $method = 'set' . ucfirst($hydrateName);
             $value = $this->hydrateValue($hydrateName, $value, $data);
             $object->{$method}($value);
         }
     }
     return $object;
 }