aw/ezp-fetch-bundle

此包已被废弃且不再维护。没有建议的替代包。

ezpublish 5的内容查询语言

安装: 44

依赖项: 0

建议者: 0

安全: 0

星星: 5

关注者: 4

分支: 2

类型:ezpublish-bundle

dev-master 2015-09-02 09:04 UTC

This package is not auto-updated.

Last update: 2020-02-21 15:52:27 UTC


README

此项目已不再维护

AwEzpFetchBundle

介绍

AwEzpFetchBundle 是搜索服务的门面。它为 eZ Publish 5 带来了内容查询语言。

包文档

包文档可在 Resources/doc/index.rst 中找到

阅读文档

安装

  1. 使用 Composer,将以下内容添加到您的 composer.json 文件中,然后运行 composer update 命令

        {
            require: {
                "aw/ezp-fetch-bundle": "dev-master",
            }
        }
  2. 通过在 EzPublishKernel.php 文件中添加以下内容来注册 AwEzpFetchBundle

    
        <?php
    
        // EzPublishKernel.php
        $bundles = array(
            // ...
            new Aw\Ezp\FetchBundle\AwEzpFetchBundle(),
            // ...
        );

使用示例

示例 1

<?php

// In controller get the fetch service
$fetcher = $this->get('aw_ezp_fetch');

$query = "{filter: {parent_location_id {EQ 2}}, limit: 20, sort: {date_modified DESC}}";

$result = $fetcher->fetch($query);

示例 2

<?php

// In controller get the fetch service
$fetcher = $this->get('aw_ezp_fetch');

$query = "{filter: {AND [subtree: {EQ '/1/2'}, visibility: {EQ true}]}, limit: 20}";

$result = $fetcher->fetch($query);

示例 3

<?php
// In controller get the fetch service
$fetcher = $this->get('aw_ezp_fetch');

$query = <<<EOS
filter:
      AND:
           - parent_location_id: {IN [2, 60]}
           - date_metadata.modified: {BETWEEN [2012-12-14, 2013-01-25]}
           - visibility: {EQ  true}
           - OR:
              - field.name: {EQ News}
              - full_text: {LIKE 'Press Release*'}

sort: {field.landing_page/name ASC, date_modified DESC}
limit: 12
offset: 14

EOS;

$result = $fetcher->fetch($query);

示例 4

<?php

// In controller get the fetch service
$fetcher = $this->get('aw_ezp_fetch');

$query = <<<EOS
filter:
      AND:
           - parent_location_id: {IN [2, 60]}
           - date_metadata.modified: {BETWEEN [2012-12-14, 2013-01-25]}
           - visibility: {EQ  true}
           - OR:
              - field.name: {EQ News}
              - full_text: {LIKE Press Release*}

sort:
     field.landing_page/name: ASC
     date_modified: DESC

limit: 12
offset: 14

EOS;

$result = $fetcher->fetch($query);

示例 5

<?php

// In controller get the fetch service
$fetcher = $this->get('aw_ezp_fetch');

$query = "{filter: {AND [subtree: {EQ @subtree}, visibility: {EQ true}]}  , limit: @limit, offset: @offset}";

$preparedFetch = $fetcher->prepare($query);

$preparedFetch->bindParam('@subtree', '/1/2');
$preparedFetch->bindParam('@offset', 0);
$preparedFetch->bindParam('@limit', 20);

$result = $preparedFetch->fetch();

//you can rebind any parameter and refetch

$preparedFetch->bindParam('@offset', 20);

$result = $preparedFetch->fetch();

许可证

代码在 MIT 许可下发布。您可以在 Resources/meta/LICENCE 中找到它