Пример #1
0
 /**
  * @param $title
  * @param null $locale
  */
 public function setTitle($title, $locale = null)
 {
     if ($locale === null) {
         $locale = $this->customerFamily->getLocale();
     }
     $this->customerFamily->setLocale($locale);
     $this->customerFamily->setTitle($title);
 }
Пример #2
0
 /**
  * @param $code
  * @param null $title
  * @param string $locale
  *
  * @return Model\CustomerFamily
  */
 public static function getCustomerFamilyByCode($code, $title = null, $locale = "fr_FR")
 {
     if ($title == null) {
         $title = $code;
     }
     /** @var CustomerFamilyModel $customerFamily */
     if (null == ($customerFamily = CustomerFamilyQuery::create()->useCustomerFamilyI18nQuery()->filterByLocale($locale)->endUse()->filterByCode($code)->findOne())) {
         //Be sure that you don't create it twice
         /** @var CustomerFamilyModel $customerF */
         if (null != ($customerF = CustomerFamilyQuery::create()->findOneByCode($code))) {
             $customerF->setLocale($locale)->setTitle($title)->save();
         } else {
             $customerFamily = new CustomerFamilyModel();
             $customerFamily->setCode($code)->setLocale($locale)->setTitle($title)->save();
         }
     }
     return $customerFamily;
 }
 /**
  * Declares an association between this object and a ChildCustomerFamily object.
  *
  * @param                  ChildCustomerFamily $v
  * @return                 \CustomerFamily\Model\CustomerCustomerFamily The current object (for fluent API support)
  * @throws PropelException
  */
 public function setCustomerFamily(ChildCustomerFamily $v = null)
 {
     if ($v === null) {
         $this->setCustomerFamilyId(NULL);
     } else {
         $this->setCustomerFamilyId($v->getId());
     }
     $this->aCustomerFamily = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildCustomerFamily object, it will not be re-added.
     if ($v !== null) {
         $v->addCustomerCustomerFamily($this);
     }
     return $this;
 }
Пример #4
0
 /**
  * Exclude object from result
  *
  * @param   ChildCustomerFamily $customerFamily Object to remove from the list of results
  *
  * @return ChildCustomerFamilyQuery The current query, for fluid interface
  */
 public function prune($customerFamily = null)
 {
     if ($customerFamily) {
         $this->addUsingAlias(CustomerFamilyTableMap::ID, $customerFamily->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * Filter the query by a related \CustomerFamily\Model\CustomerFamily object
  *
  * @param \CustomerFamily\Model\CustomerFamily|ObjectCollection $customerFamily The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildCustomerCustomerFamilyQuery The current query, for fluid interface
  */
 public function filterByCustomerFamily($customerFamily, $comparison = null)
 {
     if ($customerFamily instanceof \CustomerFamily\Model\CustomerFamily) {
         return $this->addUsingAlias(CustomerCustomerFamilyTableMap::CUSTOMER_FAMILY_ID, $customerFamily->getId(), $comparison);
     } elseif ($customerFamily instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(CustomerCustomerFamilyTableMap::CUSTOMER_FAMILY_ID, $customerFamily->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByCustomerFamily() only accepts arguments of type \\CustomerFamily\\Model\\CustomerFamily or Collection');
     }
 }