コード例 #1
0
 /**
  * @param Publication $object
  * @return mixed|void
  */
 public function preUpdate($object)
 {
     if (is_null($object->getCreatedAt())) {
         $object->setCreatedAt(new \DateTime());
     }
 }
コード例 #2
0
 /**
  * Returns next or previous publications
  *
  * @param Publication $current
  * @param int $limit
  * @param string $comparison
  * @param null $criteria
  * @return \PropelObjectCollection|Publication|null
  */
 protected function getSiblings(Publication $current, $limit, $comparison, $criteria = null)
 {
     return PublicationQuery::create(null, $criteria)->applyBaseFilter($current->getPublicationTypeKey())->filterByCreatedAt($current->getCreatedAt(), $comparison)->applySorting($comparison == \Criteria::GREATER_THAN ? \Criteria::ASC : \Criteria::DESC)->findWithLimit($limit);
 }