当前位置: 首页>>代码示例>>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;未经允许,请勿转载。