當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Model\AEntity類代碼示例

本文整理匯總了PHP中XLite\Model\AEntity的典型用法代碼示例。如果您正苦於以下問題:PHP AEntity類的具體用法?PHP AEntity怎麽用?PHP AEntity使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了AEntity類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: findOneByRecord

 /**
  * Find one by record
  *
  * @param array                $data   Record
  * @param \XLite\Model\AEntity $parent Parent model OPTIONAL
  *
  * @return \XLite\Model\AEntity|void
  */
 public function findOneByRecord(array $data, \XLite\Model\AEntity $parent = null)
 {
     if (empty($data['code'])) {
         $data['code'] = \XLite\Model\Base\Translation::DEFAULT_LANGUAGE;
     }
     return isset($parent) ? $parent->getTranslation($data['code']) : parent::findOneByRecord($data, $parent);
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:15,代碼來源:Translation.php

示例2: modifyMoney

 /**
  * Modify money 
  * 
  * @param float                $value     Value
  * @param \XLite\Model\AEntity $model     Model
  * @param string               $property  Model's property
  * @param array                $behaviors Behaviors
  * @param string               $purpose   Purpose
  *  
  * @return void
  */
 public static function modifyMoney($value, \XLite\Model\AEntity $model, $property, array $behaviors, $purpose)
 {
     foreach ($model->getOptions() as $option) {
         if ($option->getOption() && $option->getOption()->hasActiveSurcharge('price')) {
             $value += $option->getOption()->getSurcharge('price')->getAbsoluteValue();
         }
     }
     return $value;
 }
開發者ID:kingsj,項目名稱:core,代碼行數:20,代碼來源:OptionSurcharge.php

示例3: getColumnValue

 /**
  * Get column value
  *
  * @param array                $column Column
  * @param \XLite\Model\AEntity $entity Model
  *
  * @return mixed
  */
 protected function getColumnValue(array $column, \XLite\Model\AEntity $entity)
 {
     if (isset($column[static::COLUMN_PRODUCT_ATTRIBUTE])) {
         $result = $entity->getAttributeValue($column[static::COLUMN_PRODUCT_ATTRIBUTE]);
         $result = $result ? $result->asString() : '';
     } else {
         $result = parent::getColumnValue($column, $entity);
     }
     return $result;
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:18,代碼來源:ProductVariant.php

示例4: update

 /**
  * Update entity
  *
  * @param \XLite\Model\AEntity $entity Entity to update
  * @param array                $data   New values for entity properties
  * @param boolean              $flush  Flag OPTIONAL
  *
  * @return void
  */
 public function update(\XLite\Model\AEntity $entity, array $data = array(), $flush = self::FLUSH_BY_DEFAULT)
 {
     $name = null;
     foreach ($entity->getTranslations() as $translation) {
         if ($translation->getName()) {
             $name = $translation->getName();
             break;
         }
     }
     if ($name) {
         foreach ($entity->getTranslations() as $translation) {
             if (!$translation->getName()) {
                 $translation->setName($name);
             }
         }
     }
     parent::update($entity, $data, $flush);
 }
開發者ID:kewaunited,項目名稱:xcart,代碼行數:27,代碼來源:Method.php

示例5: 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

示例6: getAttributeValues

 /**
  * Return attribute values
  *
  * @param \XLite\Model\AEntity $model Model
  *
  * @return array
  */
 protected static function getAttributeValues(\XLite\Model\AEntity $model)
 {
     return $model instanceof \XLite\Module\XC\ProductVariants\Model\ProductVariant ? $model->getProduct()->getAttrValues() : parent::getAttributeValues($model);
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:11,代碼來源:AttributeSurcharge.php

示例7: isAllowEntityRemove

 /**
  * Check - remove entity or not
  *
  * @param \XLite\Model\AEntity $entity Entity
  *
  * @return boolean
  */
 protected function isAllowEntityRemove(\XLite\Model\AEntity $entity)
 {
     return $entity->isPersistent();
 }
開發者ID:kewaunited,項目名稱:xcart,代碼行數:11,代碼來源:Table.php

示例8: getLanguageHelpMessage

 /**
  * Get specific language help message
  *
  * @param \XLite\Model\AEntity $entity Language object
  *
  * @return string
  */
 protected function getLanguageHelpMessage(\XLite\Model\AEntity $entity)
 {
     $message = null;
     if ($entity->getValidModule()) {
         $moduleClass = \Includes\Utils\ModulesManager::getClassNameByModuleName($entity->getModule());
         $moduleName = sprintf('%s (%s)', $moduleClass::getModuleName(), $moduleClass::getAuthorName());
         $message = static::t('This language is added by module and cannot be removed.', array('module' => $moduleName));
     } elseif ('en' == $entity->getCode()) {
         $message = 'English language cannot be removed as it is primary language for all texts.';
     }
     return $message;
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:19,代碼來源:Languages.php

示例9: buildMetodName

 /**
  * Build metod name
  *
  * @param \XLite\Model\AEntity $entity  Entity
  * @param string               $pattern Pattern
  *
  * @return string
  */
 protected function buildMetodName(\XLite\Model\AEntity $entity, $pattern)
 {
     return static::TYPE_COUPONS == $entity->getId() ? sprintf($pattern, 'Coupons') : parent::buildMetodName($entity, $pattern);
 }
開發者ID:kewaunited,項目名稱:xcart,代碼行數:12,代碼來源:RemoveData.php

示例10: linkLoadedEntity

 /**
  * Link loaded entity to parent object
  *
  * @param \XLite\Model\AEntity $entity      Loaded entity
  * @param \XLite\Model\AEntity $parent      Entity parent callback
  * @param array                $parentAssoc Entity mapped propery method
  *
  * @return void
  */
 protected function linkLoadedEntity(\XLite\Model\AEntity $entity, \XLite\Model\AEntity $parent, array $parentAssoc)
 {
     if (!$parentAssoc['many'] || !$entity->getUniqueIdentifier() || !$parent->{$parentAssoc}['getter']()->contains($entity)) {
         // Add entity to parent
         $parent->{$parentAssoc}['setter']($entity);
         // Add parent to entity
         if ($parentAssoc['mappedSetter']) {
             $entity->{$parentAssoc}['mappedSetter']($parent);
         }
     }
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:20,代碼來源:ARepo.php

示例11: performDelete

 /**
  * Delete single entity
  *
  * @param \XLite\Model\AEntity $entity Entity to detach
  *
  * @return void
  */
 protected function performDelete(\XLite\Model\AEntity $entity)
 {
     $entity->setOldPaymentStatus(null);
     $entity->setOldShippingStatus(null);
     parent::performDelete($entity);
 }
開發者ID:kewaunited,項目名稱:xcart,代碼行數:13,代碼來源:OrderAbstract.php

示例12: isAllowEntityRemove

 /**
  * Disable removing special methods
  *
  * @param \XLite\Model\AEntity $entity Shipping method object
  *
  * @return boolean
  */
 protected function isAllowEntityRemove(\XLite\Model\AEntity $entity)
 {
     /** @var \XLite\Model\Shipping\Method $entity */
     return !$entity->getFree() && !$this->isFixedFeeMethod($entity);
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:12,代碼來源:Carriers.php

示例13: checkCache

 /**
  * Check cache after enity persist or remove
  *
  * @return void
  */
 public function checkCache()
 {
     parent::checkCache();
     // Check translation owner cache
     if ($this->getOwner()) {
         $this->getOwner()->checkCache();
     }
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:13,代碼來源:Translation.php

示例14: isHistoryConflict

 /**
  * Is conflict in history
  *
  * @return bool
  */
 protected function isHistoryConflict()
 {
     return $this->hasConflict() && $this->conflict->getCleanURL() !== $this->getValue();
 }
開發者ID:kewaunited,項目名稱:xcart,代碼行數:9,代碼來源:CleanURL.php

示例15: __construct

 /**
  * Constructor
  *
  * @param array $data Entity properties OPTIONAL
  */
 public function __construct(array $data = array())
 {
     $this->addresses = new \Doctrine\Common\Collections\ArrayCollection();
     $this->roles = new \Doctrine\Common\Collections\ArrayCollection();
     parent::__construct($data);
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:11,代碼來源:Profile.php


注:本文中的XLite\Model\AEntity類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。