protected function setUp()
 {
     if (!$this->created) {
         if (BrandQuery::create()->count() === 0) {
             $brand = new Brand();
             $brand->getTranslation()->setTitle("Foo")->setChapo("Bar")->setDescription("Baz");
             $brand->getTranslation("fr_FR")->setTitle("orange")->setChapo("banana")->setDescription("apple");
             $brand->save();
         }
         $this->created = true;
     }
 }
 /**
  * Returns the object ID from the object
  *
  * @param Brand $object
  *
  * @return int brand id
  */
 protected function getObjectId($object)
 {
     return $object->getId();
 }
Exemple #3
0
 /**
  * Declares an association between this object and a ChildBrand object.
  *
  * @param                  ChildBrand $v
  * @return                 \Thelia\Model\BrandDocument The current object (for fluent API support)
  * @throws PropelException
  */
 public function setBrand(ChildBrand $v = null)
 {
     if ($v === null) {
         $this->setBrandId(NULL);
     } else {
         $this->setBrandId($v->getId());
     }
     $this->aBrand = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildBrand object, it will not be re-added.
     if ($v !== null) {
         $v->addBrandDocument($this);
     }
     return $this;
 }
 /**
  * Filter the query by a related \Thelia\Model\Brand object
  *
  * @param \Thelia\Model\Brand|ObjectCollection $brand The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildBrandDocumentQuery The current query, for fluid interface
  */
 public function filterByBrand($brand, $comparison = null)
 {
     if ($brand instanceof \Thelia\Model\Brand) {
         return $this->addUsingAlias(BrandDocumentTableMap::BRAND_ID, $brand->getId(), $comparison);
     } elseif ($brand instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(BrandDocumentTableMap::BRAND_ID, $brand->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByBrand() only accepts arguments of type \\Thelia\\Model\\Brand or Collection');
     }
 }
Exemple #5
0
 /**
  * Filter the query by a related \Thelia\Model\Brand object
  *
  * @param \Thelia\Model\Brand|ObjectCollection $brand  the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildBrandImageQuery The current query, for fluid interface
  */
 public function filterByBrandRelatedByLogoImageId($brand, $comparison = null)
 {
     if ($brand instanceof \Thelia\Model\Brand) {
         return $this->addUsingAlias(BrandImageTableMap::ID, $brand->getLogoImageId(), $comparison);
     } elseif ($brand instanceof ObjectCollection) {
         return $this->useBrandRelatedByLogoImageIdQuery()->filterByPrimaryKeys($brand->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByBrandRelatedByLogoImageId() only accepts arguments of type \\Thelia\\Model\\Brand or Collection');
     }
 }
Exemple #6
0
 public function create(BrandCreateEvent $event)
 {
     $brand = new BrandModel();
     $brand->setVisible($event->getVisible())->setLocale($event->getLocale())->setTitle($event->getTitle())->save();
     $event->setBrand($brand);
 }
Exemple #7
0
 /**
  * Exclude object from result
  *
  * @param   ChildBrand $brand Object to remove from the list of results
  *
  * @return ChildBrandQuery The current query, for fluid interface
  */
 public function prune($brand = null)
 {
     if ($brand) {
         $this->addUsingAlias(BrandTableMap::ID, $brand->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }