Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drupal 7 如何使用entity\u get\u controller获取新创建实体的实体id_Drupal 7 - Fatal编程技术网

Drupal 7 如何使用entity\u get\u controller获取新创建实体的实体id

Drupal 7 如何使用entity\u get\u controller获取新创建实体的实体id,drupal-7,Drupal 7,我在下面的drupal a中创建新实体 $entity = new stdClass(); $entity->type = 'entity_type'; $entity->id = 0; $entity->title = 'Entity Title'; //Add data to fields $entity->field_introduction = array ( 'und' => array

我在下面的drupal a中创建新实体

$entity = new stdClass();
$entity->type = 'entity_type';
$entity->id = 0;
$entity->title = 'Entity Title';

//Add data to fields
$entity->field_introduction = array
            (
                'und' => array
                (
                    "0" => array
                    (
                        'value' => $strIntroduction
                    )
                )
            );

 .
 .
 .
 .


//After adding all the fields, I am saving entity as follows,

entity_get_controller('summary_report')->save($entity);

实体已成功保存。在此之后,我需要实体id来进行进一步的操作。如何获取新创建的实体id。

$entity
将包含您的id,因为保存实体后,对象将填充所有数据。从
save()
方法返回的数据是
TRUE
FALSE
。希望这有帮助