/** * @param Publication $object * @return mixed|void */ public function preUpdate($object) { if (is_null($object->getCreatedAt())) { $object->setCreatedAt(new \DateTime()); } }
/** * 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); }