Пример #1
0
 protected function createOrUpdate(CustomerTitleEvent $event, CustomerTitleModel $customerTitle)
 {
     $con = Propel::getConnection(CustomerTitleTableMap::DATABASE_NAME);
     $con->beginTransaction();
     $i18n = $customerTitle->getTranslation($event->getLocale(), $con);
     try {
         $i18n->setShort($event->getShort())->setLong($event->getLong());
         $customerTitle->save($con);
         if ($event->isDefault()) {
             $customerTitle->toggleDefault($con);
             $event->setDefault(false);
         }
         $con->commit();
     } catch (\Exception $e) {
         $con->rollBack();
         throw $e;
     }
     $event->setCustomerTitle($customerTitle);
 }
Пример #2
0
 /**
  * @param array $i18nRow
  * @param CustomerTitleEvent $event
  *
  * Handler to hydrate the event with i18n data
  */
 protected function hydrateEvent(array $i18nRow, CustomerTitleEvent $event)
 {
     $event->setShort($i18nRow["short"])->setLong($i18nRow["long"])->setLocale($i18nRow["locale"]);
 }