Пример #1
0
 public function createPost($values = array())
 {
     if (is_object($values)) {
         $values = (array) $values;
     }
     $post = $this->postHydrator->hydrate($values, new Post());
     return $post;
 }
Пример #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;
 }