Пример #1
0
 public function createOrUpdate(MetaDataCreateOrUpdateEvent $event)
 {
     $metaData = MetaDataQuery::create()->filterByMetaKey($event->getMetaKey())->filterByElementKey($event->getElementKey())->filterByElementId($event->getElementId())->findOne();
     if (null === $metaData) {
         $metaData = new MetaDataModel();
         $metaData->setMetaKey($event->getMetaKey())->setElementKey($event->getElementkey())->setElementId($event->getElementId());
     }
     $metaData->setValue($event->getValue());
     $metaData->save();
     $event->setMetaData($metaData);
 }
Пример #2
0
 /**
  * Add or update the MetaData element
  *
  * @param string $metaKey    the meta Key
  * @param string $elementKey the element Key : product, category, ...
  * @param int    $elementId  the element id
  */
 public static function setVal($metaKey, $elementKey, $elementId, $value)
 {
     $data = self::create()->filterByMetaKey($metaKey)->filterByElementKey($elementKey)->filterByElementId($elementId)->findOne();
     if (null === $data) {
         $data = new MetaData();
         $data->setMetaKey($metaKey);
         $data->setElementKey($elementKey);
         $data->setElementId($elementId);
     }
     $data->setValue($value);
     $data->save();
 }
Пример #3
0
 /**
  * Exclude object from result
  *
  * @param   ChildMetaData $metaData Object to remove from the list of results
  *
  * @return ChildMetaDataQuery The current query, for fluid interface
  */
 public function prune($metaData = null)
 {
     if ($metaData) {
         $this->addUsingAlias(MetaDataTableMap::ID, $metaData->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }