Ejemplo n.º 1
0
 public function createPost($values = array())
 {
     if (is_object($values)) {
         $values = (array) $values;
     }
     $post = $this->postHydrator->hydrate($values, new Post());
     return $post;
 }
Ejemplo n.º 2
0
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $hydrator = new PostHydrator();
     $hydrator->addStrategy('creation_date', new DateTimeStrategy());
     $hydrator->addStrategy('publication_date', new DateTimeStrategy());
     $hydrator->addStrategy('keywords', new KeywordStrategy());
     $hydrator->addStrategy('author', new AuthorStrategy());
     return $hydrator;
 }