コード例 #1
0
ファイル: Profile.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Clone
  *
  * @return \XLite\Model\Profile
  */
 public function cloneEntity()
 {
     $newProfile = parent::cloneEntity();
     if (!$newProfile->update(true) || !$newProfile->getProfileId()) {
         // TODO - add throw exception
         \XLite::getInstance()->doGlobalDie('Can not clone profile');
     }
     $newProfile->setMembership($this->getMembership());
     $newProfile->setPendingMembership($this->getPendingMembership());
     $newProfile->setPassword('');
     $billingAddress = $this->getBillingAddress();
     if (null !== $billingAddress) {
         $newBillingAddress = $billingAddress->cloneEntity();
         $newBillingAddress->setProfile($newProfile);
         $newProfile->addAddresses($newBillingAddress);
         $newBillingAddress->update();
     }
     $shippingAddress = $this->getShippingAddress();
     if ($shippingAddress && (!$billingAddress || $billingAddress->getAddressId() != $shippingAddress->getAddressId())) {
         $newShippingAddress = $shippingAddress->cloneEntity();
         $newShippingAddress->setProfile($newProfile);
         $newProfile->addAddresses($newShippingAddress);
         $newShippingAddress->update();
     }
     $newProfile->update(true);
     return $newProfile;
 }
コード例 #2
0
ファイル: ProductVariant.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Clone
  *
  * @return \XLite\Model\AEntity
  */
 public function cloneEntity()
 {
     $newEntity = parent::cloneEntity();
     if ($this->getSku()) {
         $newEntity->setSku(\XLite\Core\Database::getRepo('XLite\\Module\\XC\\ProductVariants\\Model\\ProductVariant')->assembleUniqueSKU($this->getSku()));
     }
     return $newEntity;
 }
コード例 #3
0
ファイル: Address.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Clone
  *
  * @return \XLite\Model\AEntity
  */
 public function cloneEntity()
 {
     $entity = parent::cloneEntity();
     if ($this->getCountry()) {
         $entity->setCountry($this->getCountry());
     }
     if ($this->getState()) {
         $entity->setState($this->getState());
     }
     return $entity;
 }
コード例 #4
0
ファイル: I18n.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Clone
  *
  * @return \XLite\Model\AEntity
  */
 public function cloneEntity()
 {
     $entity = parent::cloneEntity();
     foreach ($entity->getSoftTranslation()->getRepository()->findBy(array('owner' => $entity)) as $translation) {
         $newTranslation = $translation->cloneEntity();
         $newTranslation->setOwner($entity);
         $entity->addTranslations($newTranslation);
         \XLite\Core\Database::getEM()->persist($newTranslation);
     }
     return $entity;
 }
コード例 #5
0
ファイル: AttributeValue.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Clone attribute value of order item
  *
  * @return \XLite\Model\OrderItem\AttributeValue
  */
 public function cloneEntity()
 {
     $new = parent::cloneEntity();
     if ($this->getAttributeValue()) {
         $new->setAttributeValue($this->getAttributeValue());
     }
     return $new;
 }
コード例 #6
0
ファイル: Transaction.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Clone payment transaction
  *
  * @return \XLite\Model\Payment\Transaction
  */
 public function cloneEntity()
 {
     $newTransaction = parent::cloneEntity();
     $newTransaction->setCurrency($this->getCurrency());
     $newTransaction->setOrder($this->getOrder());
     $newTransaction->setPaymentMethod($this->getPaymentMethod());
     return $newTransaction;
 }
コード例 #7
0
ファイル: Profile.php プロジェクト: kingsj/core
 /**
  * Clone
  *
  * @return \XLite\Model\AEntity
  */
 public function cloneEntity()
 {
     $newProfile = parent::cloneEntity();
     if (!$newProfile->update(true) || !$newProfile->getProfileId()) {
         // TODO - add throw exception
         \XLite::getInstance()->doGlobalDie('Can not clone profile');
     }
     $newProfile->setMembership($this->getMembership());
     $newProfile->setPendingMembership($this->getPendingMembership());
     $billingAddress = $this->getBillingAddress();
     if (isset($billingAddress)) {
         $newBillingAddress = $billingAddress->cloneEntity();
         $newBillingAddress->setProfile($newProfile);
         $newProfile->addAddresses($newBillingAddress);
         $newBillingAddress->update();
     }
     if (!$this->isSameAddress() && $this->getShippingAddress()) {
         $newShippingAddress = $this->getShippingAddress()->cloneEntity();
         $newShippingAddress->setProfile($newProfile);
         $newProfile->addAddresses($newShippingAddress);
         $newShippingAddress->update();
     }
     $newProfile->update(true);
     return $newProfile;
 }
コード例 #8
0
ファイル: Parcel.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Clone object
  *
  * @param boolean $cloneItems Clone parcel items
  *
  * @return \XLite\Model\AEntity
  */
 public function cloneEntity($cloneItems = true)
 {
     $newParcel = parent::cloneEntity();
     if ($this->getOrder()) {
         $newParcel->setOrder($this->getOrder());
     }
     if ($cloneItems && $this->hasItems()) {
         foreach ($this->getItems() as $item) {
             $newParcel->addItem($item);
         }
     }
     return $newParcel;
 }
コード例 #9
0
ファイル: OrderItemOption.php プロジェクト: kingsj/core
 /**
  * Clone order item option object
  *
  * @return \XLite\Model\AEntity
  */
 public function cloneEntity()
 {
     $entity = parent::cloneEntity();
     if ($this->getOption()) {
         $entity->setOption($this->getOption());
     }
     if ($this->getGroup()) {
         $entity->setGroup($this->getGroup());
     }
     return $entity;
 }