当前位置: 首页>>代码示例>>PHP>>正文


PHP AEntity::cloneEntity方法代码示例

本文整理汇总了PHP中XLite\Model\AEntity::cloneEntity方法的典型用法代码示例。如果您正苦于以下问题:PHP AEntity::cloneEntity方法的具体用法?PHP AEntity::cloneEntity怎么用?PHP AEntity::cloneEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XLite\Model\AEntity的用法示例。


在下文中一共展示了AEntity::cloneEntity方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cloneEntity

 /**
  * 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;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:32,代码来源:Profile.php

示例2: cloneEntity

 /**
  * 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;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:ProductVariant.php

示例3: cloneEntity

 /**
  * 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;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:16,代码来源:Address.php

示例4: cloneEntity

 /**
  * 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;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:16,代码来源:I18n.php

示例5: cloneEntity

 /**
  * 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;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:AttributeValue.php

示例6: cloneEntity

 /**
  * 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;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:Transaction.php

示例7: cloneEntity

 /**
  * 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;
 }
开发者ID:kingsj,项目名称:core,代码行数:30,代码来源:Profile.php

示例8: cloneEntity

 /**
  * 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;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:20,代码来源:Parcel.php

示例9: cloneEntity

 /**
  * 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;
 }
开发者ID:kingsj,项目名称:core,代码行数:16,代码来源:OrderItemOption.php


注:本文中的XLite\Model\AEntity::cloneEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。