本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}