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


PHP Entity::getProperties方法代码示例

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


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

示例1: getKeyValuePropertiesByEntity

 /**
  * This functions builds an array (key\value) with entity data, to later insert on the db
  *
  * @param Entity $entity
  *
  * @return array
  */
 private function getKeyValuePropertiesByEntity(Entity $entity)
 {
     $properties = array_keys($entity->getProperties());
     $keyValueProperties = array();
     foreach ($properties as $property) {
         $method = $this->getterMethodToGetPropertyValue($property);
         $propertyValue = $entity->{$method}();
         if (is_null($propertyValue)) {
             continue;
         }
         $annotations = $this->annotation->getAnnotationsByProperty($property, $entity);
         $propertyKey = $this->getValueOfAnnotation($annotations, self::PROPERTY_ANNOTATION);
         $keyValueProperties[$propertyKey] = $propertyValue;
     }
     return $keyValueProperties;
 }
开发者ID:karlozz157,项目名称:orm,代码行数:23,代码来源:UnitOfWork.php

示例2: generateSql

 private function generateSql(Entity $entity)
 {
     $table = $entity->getTable();
     $primKey = $entity->getPrimaryKey();
     $sql = "CREATE TABLE `{$table}` (\n";
     $sql .= "\t`{$primKey->getName()}` {$primKey->getDbType()} NOT NULL AUTO_INCREMENT,\n";
     foreach ($entity->getProperties() as $property) {
         $sql .= "\t`{$property->getName()}` {$property->getDbType()} NOT NULL,\n";
     }
     foreach (Singleton::create("ServiceBuilder")->getOneToManyMappedProperties($entity) as $property) {
         $sql .= "\t`{$property->getMappingKey()}` {$property->getEntity()->getPrimaryKey()->getDbType()} NOT NULL,\n";
     }
     $sql .= implode(",\n", $this->generateIndexes($entity));
     $sql .= "\n);";
     return $sql;
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:16,代码来源:SqlGenerator.php

示例3: ValidateEntityPropertiesCheck

 /**
  * Валидирует значение свойств у объекта
  *
  * @param Entity $oTarget
  *
  * @return bool|string
  */
 public function ValidateEntityPropertiesCheck($oTarget)
 {
     /**
      * Пробуем получить свойства из реквеста
      */
     $oTarget->setProperties($oTarget->getProperties() ? $oTarget->getProperties() : getRequest('property'));
     $aPropertiesValue = $oTarget->getProperties();
     $aPropertiesResult = array();
     /**
      * Получаем весь список свойств у объекта
      */
     $aPropertiesObject = $this->Property_GetPropertyItemsByFilter(array('target_type' => $oTarget->property->getPropertyTargetType()));
     $this->Property_AttachValueForProperties($aPropertiesObject, $oTarget->property->getPropertyTargetType(), $oTarget->getId());
     foreach ($aPropertiesObject as $oProperty) {
         $oValue = $oProperty->getValue();
         $sValue = isset($aPropertiesValue[$oProperty->getId()]) ? $aPropertiesValue[$oProperty->getId()] : null;
         /**
          * Валидируем значение
          */
         $oValueType = $oValue->getValueTypeObject();
         $oValueType->setValueForValidate($sValue);
         if (true === ($sRes = $oValueType->validate())) {
             $oValueType->setValue($oValueType->getValueForValidate());
             $aPropertiesResult[$oProperty->getId()] = $oProperty;
         } else {
             return 'Поле "' . $oProperty->getTitle() . '": ' . ($sRes ? $sRes : 'неверное значение');
         }
     }
     $oTarget->setPropertiesObject($aPropertiesResult);
     return true;
 }
开发者ID:pinguo-liguo,项目名称:livestreet,代码行数:38,代码来源:Property.class.php


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