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


PHP Entity::create方法代码示例

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


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

示例1: createObject

 /**
  * @param Entity              $entity
  * @param array               $record
  * @param Metadata\Relation[] $relations
  * @param                     $readOnly
  *
  * @return mixed
  */
 private function createObject(Entity $entity, array $record, array $relations, $readOnly)
 {
     $fields = $entity->getFieldNames();
     $object = $entity->create(array_intersect_key($record, $fields), true);
     $entity->setReadOnly($object, $readOnly);
     foreach ($relations as $relation) {
         $relation->set($object, $relation->getEmptyValue());
     }
     return $object;
 }
开发者ID:bugadani,项目名称:orminy,代码行数:18,代码来源:ResultProcessor.php

示例2: sync

 public static function sync($e)
 {
     $entity = Entity::load($e->entity_service, $e->entity_type, $e->entity_id);
     if (empty($entity)) {
         // create
         echo "CREATE {$e->entity_service}, {$e->entity_type}, {$e->entity_id}\n";
         Entity::create($e);
     } else {
         echo "UPDATE {$e->entity_service}, {$e->entity_type}, {$e->entity_id}\n";
         // sync
         $entity->update($e);
     }
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:13,代码来源:Entity.php

示例3: createAmenity

 /**
  * Create a new amenity.
  * @param $clustername : cluster's name from the url
  * @param $name : the name of the amenity to be created
  *
  */
 public function createAmenity(Cluster $cluster, $name)
 {
     $content = Request::instance()->getContent();
     if (empty($content)) {
         return $this->_sendErrorMessage(400, "Payload.Null", "Received payload is empty.");
     }
     if (Input::json() == null) {
         return $this->_sendErrorMessage(400, "Payload.Invalid", "Received payload is invalid.");
     }
     if (!strcmp($cluster->clustername, Auth::user()->clustername) || Auth::user()->isAdmin()) {
         /* This Validator verify that the schema value is a valid json-schema
            definition. */
         $amenity_validator = Validator::make(Input::json()->all(), array('description' => 'required', 'schema' => 'required|schema'));
         if (!$amenity_validator->fails()) {
             $amenity = Entity::where('name', '=', $name)->first();
             if (isset($amenity)) {
                 $amenity->body = json_encode(Input::json()->get('schema'));
                 $amenity->save();
             } else {
                 return Entity::create(array('name' => $name, 'type' => 'amenity', 'body' => json_encode(Input::json()->get('schema')), 'user_id' => $cluster->user->id));
             }
         } else {
             return $this->_sendValidationErrorMessage($amenity_validator);
         }
     } else {
         return $this->_sendErrorMessage(403, "WriteAccessForbiden", "You can't create amenities on behalf of another user.");
     }
 }
开发者ID:tallcoder,项目名称:Reservations,代码行数:34,代码来源:EntityController.php

示例4: sync

 public static function sync($e)
 {
     $entity = Entity::load($e->entity_service, $e->entity_type, $e->entity_id);
     if (empty($entity)) {
         // create
         Entity::create($e);
     } else {
         // sync
         $entity->update($e);
     }
 }
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:11,代码来源:CNEntity.php

示例5: create

 /**
  *  @param $id Order id description 
  */
 public function create($attributes = array())
 {
     return parent::create($attributes);
 }
开发者ID:kousik,项目名称:tidiit,代码行数:7,代码来源:Order.php


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