/**
  * Exclude object from result
  *
  * @param   ChildCategoryAssociatedContent $categoryAssociatedContent Object to remove from the list of results
  *
  * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
  */
 public function prune($categoryAssociatedContent = null)
 {
     if ($categoryAssociatedContent) {
         $this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $categoryAssociatedContent->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Example #2
0
 /**
  * Filter the query by a related \Thelia\Model\CategoryAssociatedContent object
  *
  * @param \Thelia\Model\CategoryAssociatedContent|ObjectCollection $categoryAssociatedContent  the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildCategoryQuery The current query, for fluid interface
  */
 public function filterByCategoryAssociatedContent($categoryAssociatedContent, $comparison = null)
 {
     if ($categoryAssociatedContent instanceof \Thelia\Model\CategoryAssociatedContent) {
         return $this->addUsingAlias(CategoryTableMap::ID, $categoryAssociatedContent->getCategoryId(), $comparison);
     } elseif ($categoryAssociatedContent instanceof ObjectCollection) {
         return $this->useCategoryAssociatedContentQuery()->filterByPrimaryKeys($categoryAssociatedContent->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByCategoryAssociatedContent() only accepts arguments of type \\Thelia\\Model\\CategoryAssociatedContent or Collection');
     }
 }
Example #3
0
 public function addContent(CategoryAddContentEvent $event)
 {
     if (CategoryAssociatedContentQuery::create()->filterByContentId($event->getContentId())->filterByCategory($event->getCategory())->count() <= 0) {
         $content = new CategoryAssociatedContent();
         $content->setDispatcher($event->getDispatcher())->setCategory($event->getCategory())->setContentId($event->getContentId())->save();
     }
 }