2017 © Pedro Peláez
 

ezpublish-bundle ezp-fetch-bundle

A content query language for ezpublish 5

image

aw/ezp-fetch-bundle

A content query language for ezpublish 5

  • Wednesday, September 2, 2015
  • by aw
  • Repository
  • 4 Watchers
  • 5 Stars
  • 44 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

This project is no longer maintained, (*1)

AwEzpFetchBundle

Presentation

AwEzpFetchBundle is a facade for the search service. It brings a content query language for eZ Publish 5., (*2)

Bundle documentation

The bundle documentation is available in Resources/doc/index.rst, (*3)

Read the Documentation, (*4)

Installation

  1. With Composer add the following to your composer.json file, then run composer update command:, (*5)


    { require: { "aw/ezp-fetch-bundle": "dev-master", } }
  2. Register AwEzpFetchBundle by adding following to EzPublishKernel.php file:, (*6)


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

Usage examples

Example 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);

Example 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);

Example 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);

Example 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);

Example 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();

License

The code is released under the MIT License. You can find in Resources/meta/LICENCE, (*7)

The Versions

02/09 2015

dev-master

9999999-dev

A content query language for ezpublish 5

  Sources   Download

MIT

The Requires

 

fetch query ezpublish5