Пример #1
0
 /**
  * Declares an association between this object and a ChildContent object.
  *
  * @param                  ChildContent $v
  * @return                 \Thelia\Model\ProductAssociatedContent The current object (for fluent API support)
  * @throws PropelException
  */
 public function setContent(ChildContent $v = null)
 {
     if ($v === null) {
         $this->setContentId(NULL);
     } else {
         $this->setContentId($v->getId());
     }
     $this->aContent = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildContent object, it will not be re-added.
     if ($v !== null) {
         $v->addProductAssociatedContent($this);
     }
     return $this;
 }
 /**
  * Filter the query by a related \Thelia\Model\Content object
  *
  * @param \Thelia\Model\Content|ObjectCollection $content The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface
  */
 public function filterByContent($content, $comparison = null)
 {
     if ($content instanceof \Thelia\Model\Content) {
         return $this->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $content->getId(), $comparison);
     } elseif ($content instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByContent() only accepts arguments of type \\Thelia\\Model\\Content or Collection');
     }
 }
Пример #3
0
 /**
  * Returns the object ID from the object
  *
  * @param Content $object
  *
  * @return int content id
  */
 protected function getObjectId($object)
 {
     return $object->getId();
 }
Пример #4
0
 /**
  * @param LoopResultRow $loopResultRow
  * @param ContentModel $content
  * @param int $defaultFolderId
  */
 private function findNextPrev(LoopResultRow $loopResultRow, ContentModel $content, $defaultFolderId)
 {
     if ($this->getWithPrevNextInfo()) {
         $currentPosition = ContentFolderQuery::create()->filterByFolderId($defaultFolderId)->filterByContentId($content->getId())->findOne()->getPosition();
         // Find previous and next content
         $previousQuery = ContentFolderQuery::create()->filterByFolderId($defaultFolderId)->filterByPosition($currentPosition, Criteria::LESS_THAN);
         $nextQuery = ContentFolderQuery::create()->filterByFolderId($defaultFolderId)->filterByPosition($currentPosition, Criteria::GREATER_THAN);
         if (!$this->getBackendContext()) {
             $previousQuery->useContentQuery()->filterByVisible(true)->endUse();
             $previousQuery->useContentQuery()->filterByVisible(true)->endUse();
         }
         $previous = $previousQuery->orderByPosition(Criteria::DESC)->findOne();
         $next = $nextQuery->orderByPosition(Criteria::ASC)->findOne();
         $loopResultRow->set("HAS_PREVIOUS", $previous != null ? 1 : 0)->set("HAS_NEXT", $next != null ? 1 : 0)->set("PREVIOUS", $previous != null ? $previous->getContentId() : -1)->set("NEXT", $next != null ? $next->getContentId() : -1);
     }
 }
Пример #5
0
 /**
  * Exclude object from result
  *
  * @param   ChildContent $content Object to remove from the list of results
  *
  * @return ChildContentQuery The current query, for fluid interface
  */
 public function prune($content = null)
 {
     if ($content) {
         $this->addUsingAlias(ContentTableMap::ID, $content->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }