Esempio n. 1
0
 protected function getMediaModelInstance($t2_object_id)
 {
     $obj = new ProductImage();
     return $obj->setProductId($t2_object_id);
 }
 /**
  * Declares an association between this object and a ChildProductImage object.
  *
  * @param                  ChildProductImage $v
  * @return                 \Thelia\Model\ProductSaleElementsProductImage The current object (for fluent API support)
  * @throws PropelException
  */
 public function setProductImage(ChildProductImage $v = null)
 {
     if ($v === null) {
         $this->setProductImageId(NULL);
     } else {
         $this->setProductImageId($v->getId());
     }
     $this->aProductImage = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildProductImage object, it will not be re-added.
     if ($v !== null) {
         $v->addProductSaleElementsProductImage($this);
     }
     return $this;
 }
 /**
  * @param ProductImage $image
  * @return ImageEvent
  */
 public function createProductImageEvent(ProductImage $image)
 {
     $imageEvent = new ImageEvent($this->request);
     $baseSourceFilePath = ConfigQuery::read('images_library_path');
     if ($baseSourceFilePath === null) {
         $baseSourceFilePath = THELIA_LOCAL_DIR . 'media' . DS . 'images';
     } else {
         $baseSourceFilePath = THELIA_ROOT . $baseSourceFilePath;
     }
     // Put source image file path
     $sourceFilePath = sprintf('%s/%s/%s', $baseSourceFilePath, 'product', $image->getFile());
     $imageEvent->setSourceFilepath($sourceFilePath);
     $imageEvent->setCacheSubdirectory('product');
     return $imageEvent;
 }
Esempio n. 4
0
 /**
  * Filter the query by a related \Thelia\Model\ProductImage object
  *
  * @param \Thelia\Model\ProductImage|ObjectCollection $productImage  the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildProductQuery The current query, for fluid interface
  */
 public function filterByProductImage($productImage, $comparison = null)
 {
     if ($productImage instanceof \Thelia\Model\ProductImage) {
         return $this->addUsingAlias(ProductTableMap::ID, $productImage->getProductId(), $comparison);
     } elseif ($productImage instanceof ObjectCollection) {
         return $this->useProductImageQuery()->filterByPrimaryKeys($productImage->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByProductImage() only accepts arguments of type \\Thelia\\Model\\ProductImage or Collection');
     }
 }
 /**
  * Filter the query by a related \Thelia\Model\ProductImage object
  *
  * @param \Thelia\Model\ProductImage|ObjectCollection $productImage The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildProductSaleElementsProductImageQuery The current query, for fluid interface
  */
 public function filterByProductImage($productImage, $comparison = null)
 {
     if ($productImage instanceof \Thelia\Model\ProductImage) {
         return $this->addUsingAlias(ProductSaleElementsProductImageTableMap::PRODUCT_IMAGE_ID, $productImage->getId(), $comparison);
     } elseif ($productImage instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ProductSaleElementsProductImageTableMap::PRODUCT_IMAGE_ID, $productImage->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByProductImage() only accepts arguments of type \\Thelia\\Model\\ProductImage or Collection');
     }
 }
Esempio n. 6
0
 /**
  * Exclude object from result
  *
  * @param   ChildProductImage $productImage Object to remove from the list of results
  *
  * @return ChildProductImageQuery The current query, for fluid interface
  */
 public function prune($productImage = null)
 {
     if ($productImage) {
         $this->addUsingAlias(ProductImageTableMap::ID, $productImage->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }