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


PHP EntityFieldQuery::execute方法代码示例

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


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

示例1: getBillingCycle

 /**
  * Returns the user's billing cycle with the provided start time.
  *
  * If an existing billing cycle matches the expected start and end, it will
  * be returned. Otherwise, a new one will be created.
  *
  * @param $uid
  *   The uid of the user.
  * @param $start
  *   The unix timestamp when the billing cycle needs to start.
  * @param $save
  *   Whether to save the created billing cycle entity.
  *   Passing FALSE allows an unsaved billing cycle entity to be returned
  *   for estimation purposes.
  *
  * @return
  *   A cl_billing_cycle entity.
  */
 public function getBillingCycle($uid, $start = REQUEST_TIME, $save = TRUE)
 {
     // Make the billing cycle exactly 30 days long, so that it can be divided
     // predictably for prorating.
     // The 1 is substracted to make sure that the billing cycle ends 1s before
     // the next one starts
     $end = $start + 2592000 - 1;
     // Try to find an existing billing cycle matching our parameters.
     $query = new EntityFieldQuery();
     $query->entityCondition('entity_type', 'cl_billing_cycle')->entityCondition('bundle', $this->name)->propertyCondition('status', 1)->propertyCondition('uid', $uid);
     if ($start != REQUEST_TIME) {
         // In case of a custom start, make sure to match the exact billing cycle.
         // Ensures that new orders get the previous billing cycle created at the
         // start of testing, while getNextBillingCycle returns the expected result.
         $query->propertyCondition('start', $start);
     }
     $result = $query->execute();
     if ($result) {
         $billing_cycle_id = key($result['cl_billing_cycle']);
         $billing_cycle = entity_load_single('cl_billing_cycle', $billing_cycle_id);
     } else {
         // No existing billing cycle found. Create a new one.
         $billing_cycle = entity_create('cl_billing_cycle', array('type' => $this->name));
         $billing_cycle->uid = $uid;
         $billing_cycle->start = $start;
         $billing_cycle->end = $end;
         $billing_cycle->status = 1;
         if ($save) {
             $billing_cycle->save();
         }
     }
     return $billing_cycle;
 }
开发者ID:ivanvincent,项目名称:imsv_fe,代码行数:51,代码来源:CommerceLicenseBillingCycleTypeTest.class.php

示例2: quatro_preprocess_page

function quatro_preprocess_page(&$vars)
{
    // Set the page title for the "Verein" Panels Page
    if (arg(0) == 'verein' && is_numeric(arg(1))) {
        //dpm($vars);
        $nid = arg(1);
        // Search for the "Mannschaft" Node matching the argument
        $query = new EntityFieldQuery();
        $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'mannschaft')->propertyCondition('status', NODE_PUBLISHED)->propertyCondition('nid', $nid, '=')->addTag('DANGEROUS_ACCESS_CHECK_OPT_OUT');
        $result = $query->execute();
        // Set the page title to the Node Title of the "Mannschaft" Node
        if (isset($result['node'])) {
            $node_ids = array_keys($result['node']);
            $node_id = $node_ids[0];
            $node = node_load($node_id);
            drupal_set_title($node->title);
        }
    }
    // Set the page title for the "Spieler" Panels Page
    if (arg(0) == 'spieler' && is_numeric(arg(1))) {
        //dpm($vars);
        $nid = arg(1);
        // Search for the ticket matching the Rabattcode
        $query = new EntityFieldQuery();
        $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'spieler')->propertyCondition('status', NODE_PUBLISHED)->propertyCondition('nid', $nid, '=')->addTag('DANGEROUS_ACCESS_CHECK_OPT_OUT');
        $result = $query->execute();
        // If a ticket was found, set the price field to the ticket price
        if (isset($result['node'])) {
            $node_ids = array_keys($result['node']);
            $node_id = $node_ids[0];
            $node = node_load($node_id);
            drupal_set_title($node->title);
        }
    }
}
开发者ID:eigentor,项目名称:sbl,代码行数:35,代码来源:template.php

示例3: loadConvenzioneFromTarga

 private function loadConvenzioneFromTarga($ar_data)
 {
     $query = new EntityFieldQuery();
     $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'parkauto')->propertyCondition('status', 1)->fieldCondition('field_p_targa_auto_cliente', 'value', trim($ar_data['rc_targa_auto_cliente']), '=')->fieldCondition('field_p_sito_parking', 'nid', trim($ar_data['sito']))->range(0, 1)->addMetaData('account', user_load(1));
     $qryres = $query->execute();
     return $qryres;
 }
开发者ID:remo-candeli,项目名称:remoc-test,代码行数:7,代码来源:movimenti_cliente.php

示例4: load_data

 public function load_data($ar_data = null)
 {
     $result = array();
     $query = new EntityFieldQuery();
     $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'sito_parcheggio')->propertyCondition('status', 1)->addMetaData('account', user_load(1));
     $qryres = $query->execute();
     if (isset($qryres['node'])) {
         $items_nids = array_keys($qryres['node']);
         $items = entity_load('node', $items_nids);
         $first = true;
         foreach ($items as $nodo => $elem) {
             if ($first) {
                 $result[0]['codice'] = 0;
                 $result[0]['descrizione'] = 'Selezionare un parcheggio';
                 $first = false;
             }
             $result[$nodo]['codice'] = $elem->field_sp_codice[LANGUAGE_NONE][0]['value'];
             $result[$nodo]['descrizione'] = $elem->title;
             $result[$nodo]['indirizzo']['indirizzo'] = $elem->field_sp_indirizzo[LANGUAGE_NONE][0]['thoroughfare'];
             $result[$nodo]['indirizzo']['cap'] = $elem->field_sp_indirizzo[LANGUAGE_NONE][0]['postal_code'];
             $result[$nodo]['indirizzo']['localita'] = $elem->field_sp_indirizzo[LANGUAGE_NONE][0]['locality'];
             $result[$nodo]['indirizzo']['provincia'] = $elem->field_sp_indirizzo[LANGUAGE_NONE][0]['administrative_area'];
         }
     }
     $this->ar_lista = $result;
 }
开发者ID:remo-candeli,项目名称:remoc-test,代码行数:26,代码来源:sito_parcheggio.php

示例5: queryLoad

 protected function queryLoad($ids)
 {
     $multifields = multifield_get_fields();
     foreach (array_keys($multifields) as $field_name) {
         $query = new EntityFieldQuery();
         if ($ids) {
             $query->fieldCondition($field_name, 'id', $ids, 'IN');
         } else {
             $query->fieldCondition($field_name, 'id', 0, '>');
         }
         if ($results = $query->execute()) {
             $pseudo_entities = array();
             $field = field_info_field($field_name);
             foreach ($results as $entity_type => $entities) {
                 // Simply doing an entity load on the entities with multifield values
                 // will cause the cacheSet() from multifield_field_load() to get
                 // invoked.
                 $entities = entity_load($entity_type, array_keys($entities));
                 foreach ($entities as $entity) {
                     if ($items = field_get_items($entity_type, $entity, $field_name)) {
                         foreach ($items as $item) {
                             $pseudo_entities[$item['id']] = _multifield_field_item_to_entity($field['type'], $item);
                         }
                     }
                 }
             }
             $this->cacheSet($pseudo_entities);
         }
     }
     return array_intersect_key($this->entityCache, drupal_map_assoc($ids, $ids));
 }
开发者ID:juanmnl07,项目名称:dandeleon,代码行数:31,代码来源:MultifieldEntityController.php

示例6: hook_get_group_content_ids_alter

/**
 * Allows overriding of the selected entity list for cloning.
 *
 * @param $ids
 *   An array of entity ids currently selected.
 * @return
 *   An array of entity ids after processing.
 */
function hook_get_group_content_ids_alter(&$ids)
{
    // array of content types to remove from cloning
    $content_types = array('cle_submission');
    // pull out nodes for testing as this could have other entities
    foreach ($ids as $key => $id) {
        if ($id['entity_type'] == 'node') {
            $id_key[$key] = $id['etid'];
        }
    }
    // Don't allow submissions to be cloned
    $query = new EntityFieldQuery();
    // select all nodes
    $query->entityCondition('entity_type', 'node')->entityCondition('bundle', $content_types, 'IN')->propertyCondition('nid', $id_key, 'IN')->addMetaData('account', user_load(1));
    $result = $query->execute();
    // verify that we have results
    if (isset($result['node'])) {
        // test the node array against the nodes in the clone array
        foreach ($result['node'] as $node) {
            // if the node selected is in the array, remove it from the ids
            if (in_array($node->nid, $id_key)) {
                unset($ids[array_search($node->nid, $id_key)]);
            }
        }
    }
}
开发者ID:kreynen,项目名称:elmsln,代码行数:34,代码来源:og_clone.api.php

示例7: community_features_user_feed

function community_features_user_feed()
{
    $uid = $GLOBALS['user']->uid;
    $flags = flag_get_user_flags('user', null, $uid);
    //dpm($flags);
    //unset($flags['cf_follow_user']);
    if (isset($flags['cf_follow_user'])) {
        //dpm($flags['cf_follow_user']);
        foreach ($flags['cf_follow_user'] as $flag) {
            //dpm($flag);
            $author_uid = $flag->entity_id;
            $query = new EntityFieldQuery();
            $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'cm_show')->propertyCondition('status', 1)->propertyCondition('uid', $author_uid)->propertyOrderBy('created', 'DESC')->fieldCondition('field_show_vod', 'fid', 'NULL', '!=')->pager(5);
            //->range(0, 100);
            $result = $query->execute();
            if (isset($result['node'])) {
                $nids = array_keys($result['node']);
                $nodes = entity_load('node', $nids);
                foreach ($nodes as $node) {
                    $items[$node->nid] = array('node' => $node);
                }
            }
        }
        $build['pager'] = array('#theme' => 'pager', '#weight' => 5);
        //dpm($items);
        // Send data to TPL.
        return theme('cf_user_feed_all', array('content' => isset($items) ? $items : '', 'pager' => $build['pager']));
    } else {
        return '<br/> You are currently not following any users. Please follow some users and their videos will appear here.';
    }
}
开发者ID:emilyf,项目名称:CM-Bootstrap-Modules,代码行数:31,代码来源:community_features_user_feed.php

示例8: getEntityID

 /**
  * Get the entity ID.
  *
  * @param $entity_type
  *   'node', 'user', etc.
  * @param $title
  *   Title of the entity.
  * @param $bundle
  *   Optional; The bundle of the entity.
  *
  * @return mixed
  *   The entity ID (in case of $return).
  */
 public static function getEntityID($entity_type, $title, $bundle = NULL)
 {
     $query = new EntityFieldQuery();
     $query->entityCondition('entity_type', $entity_type);
     if ($entity_type == 'node') {
         $query->propertyCondition('title', $title);
     } else {
         if ($entity_type == 'file') {
             $query->propertyCondition('filename', $title);
         }
     }
     if ($bundle) {
         $query->entityCondition('bundle', $bundle);
     }
     $result = $query->execute();
     // Currently only support file and node.
     if ($entity_type == 'node') {
         $identifier = 'nid';
     } else {
         if ($entity_type == 'file') {
             $identifier = 'fid';
         }
     }
     if (empty($result[$entity_type])) {
         return NULL;
     }
     return reset($result[$entity_type])->{$identifier};
 }
开发者ID:aleph-n,项目名称:opencholar,代码行数:41,代码来源:FeatureHelper.php

示例9: hook_commerce_product_can_delete

/**
 * Lets modules prevent the deletion of a particular product.
 *
 * Before a product can be deleted, other modules are given the chance to say
 * whether or not the action should be allowed. Modules implementing this hook
 * can check for reference data or any other reason to prevent a product from
 * being deleted and return FALSE to prevent the action.
 *
 * This is an API level hook, so implementations should not display any messages
 * to the user (although logging to the watchdog is fine).
 *
 * @param $product
 *   The product to be deleted.
 *
 * @return
 *   TRUE or FALSE indicating whether or not the given product can be deleted.
 *
 * @see commerce_product_reference_commerce_product_can_delete()
 */
function hook_commerce_product_can_delete($product)
{
    // Use EntityFieldQuery to look for line items referencing this product and do
    // not allow the delete to occur if one exists.
    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'commerce_line_item', '=')->entityCondition('bundle', 'product', '=')->fieldCondition('product', 'product_id', $product->product_id, '=')->count();
    return $query->execute() > 0 ? FALSE : TRUE;
}
开发者ID:boiler256,项目名称:drupalcommerce,代码行数:27,代码来源:commerce_product.api.php

示例10: scanReports

    private function scanReports () {
        $this->affected = array();

        $query = new \EntityFieldQuery();
        $query->entityCondition('entity_type', 'node');
        $query->propertyCondition('type', NODE_TYPE_REPORT);
        $query->addTag('DANGEROUS_ACCESS_CHECK_OPT_OUT');
        $result = $query->execute();
        $reportNids = isset($result['node']) ? array_keys($result['node']) : NULL;
        $reportNodes = node_load_multiple($reportNids);
        
        foreach ( $reportNodes as $node ) {
            $datasetName = get_node_field_value($node,'field_report_dataset_sysnames');
            if ( empty($datasetName) ) {
                $patient = array(
                    'info' => array(
                        'reportNodeId' => $node->nid,
                        'reportTitle' => $node->title,
                        'published' => $node->status,
                        'type' => $node->type,
                        'datasetName' => $datasetName
                    ),
                    'notes' => 'Dataset field is empty.'
                );

                $this->attachTreatment($patient);
                $this->affected[] = $patient;
                continue;
            }

            // lookup dataset
            $datasourceQuery = new \EntityFieldQuery();
            $datasourceQuery->entityCondition('entity_type', 'node');
            $datasourceQuery->propertyCondition('type', NODE_TYPE_DATASET);
            $datasourceQuery->addTag('DANGEROUS_ACCESS_CHECK_OPT_OUT');
            $datasourceQuery->fieldCondition('field_dataset_sysname', 'value', $datasetName);
            $datasourceQuery->fieldCondition('field_dataset_datasource', 'value', get_node_field_value($node,'field_report_datasource'));
            $datasourceEntities = $datasourceQuery->execute();
            $datasource_nids = isset($datasourceEntities['node']) ? array_keys($datasourceEntities['node']) : NULL;

            if (count($datasource_nids) != 1) {
                $patient = array(
                    'info' => array(
                        'reportNodeId' => $node->nid,
                        'reportTitle' => $node->title,
                        'published' => $node->status,
                        'type' => $node->type,
                        'datasetName' => $datasetName
                    ),
                    'notes' => 'Dataset does not exist.'
                );

                $this->attachTreatment($patient);
                $this->affected[] = $patient;
                continue;
            }
        }
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:58,代码来源:MissingDatasetSymptom.php

示例11: cob_calendar_node_id

/**
 * @param string $calendarId
 * @return int
 */
function cob_calendar_node_id($calendarId)
{
    $query = new EntityFieldQuery();
    $query->fieldCondition('field_google_calendar_id', 'value', $calendarId, '=');
    $result = $query->execute();
    if (count($result)) {
        return array_keys($result['node'])[0];
    }
}
开发者ID:City-of-Bloomington,项目名称:drupal-customizations,代码行数:13,代码来源:cob_calendars.php

示例12: drupalUserFromPuid

 /**
  * @param scalar $puid is permanent unique id value and
  */
 public function drupalUserFromPuid($puid)
 {
     $query = new EntityFieldQuery();
     $query->entityCondition('entity_type', 'user')->fieldCondition('ldap_user_puid_sid', 'value', $this->sid, '=')->fieldCondition('ldap_user_puid', 'value', $puid, '=')->fieldCondition('ldap_user_puid_property', 'value', $this->unique_persistent_attr, '=')->addMetaData('account', user_load(1));
     // run the query as user 1
     $result = $query->execute();
     if (isset($result['user'])) {
         $user = entity_load('user', array_keys($result['user']));
     }
 }
开发者ID:bellcom,项目名称:syddjurs.dk,代码行数:13,代码来源:LdapServer.class.php

示例13: wyc_get_uid_by_wycnumber

function wyc_get_uid_by_wycnumber($no)
{
    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'user')->fieldCondition('field_wyc_number', 'value', $no);
    $result = $query->execute();
    if (!empty($result['user'])) {
        return key($result['user']);
    }
    return 0;
}
开发者ID:sodacrackers,项目名称:washyacht,代码行数:10,代码来源:wyc_drush_helpers.php

示例14: _query_products_nids

/**
 *
 */
function _query_products_nids()
{
    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'node')->entityCondition('bundle', array('card', 'software', 'chassis'))->propertyCondition('status', 1);
    $result = $query->execute();
    $nids = NULL;
    if (isset($result['node'])) {
        $nids = array_keys($result['node']);
    }
    return $nids;
}
开发者ID:temptemp5678,项目名称:onequote2,代码行数:14,代码来源:update_product_info.php

示例15: get_nodes_by_reference

function get_nodes_by_reference($bundle, $field, $nid, $view_mode)
{
    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'node')->entityCondition('bundle', $bundle)->propertyCondition('status', NODE_PUBLISHED)->fieldCondition($field, 'target_id', $nid, '=')->addMetaData('account', user_load(1));
    $result = $query->execute();
    if (isset($result['node'])) {
        $nids = array_keys($result['node']);
        $nodes = entity_load('node', $nids);
        return node_view_multiple($nodes, $view_mode);
    }
    return FALSE;
}
开发者ID:bert-bruggeman,项目名称:e2e_themes,代码行数:12,代码来源:helpers.inc.php


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