2017 © Pedro Peláez
 

library kunstmaan-feed-bundle

image

syzygypl/kunstmaan-feed-bundle

  • Friday, July 27, 2018
  • by Mateusz Dołęga
  • Repository
  • 4 Watchers
  • 2 Stars
  • 788 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 41 % Grown

The README.md

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*1)

$ composer require syzygypl/kunstmaan-feed-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*2)

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:, (*3)

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new  SZG\KunstmaanFeedBundle\KunstmaanFeedBundle(),
        );

        // ...
    }

    // ...
}

Usage

article below represents an indexed type. It may be define as search_type in page configuration., (*4)

``` yml kunstmaan_node: pages: 'AppBundle\Entity\Pages\ArticlePage': ... indexable: true search_type: article, (*5)


### TWIG ##### Most recent 100 articles: ```jinja {# Short notation, use defaults #} {% set articles = get_article_feed() %} {# Simple notation #} {% set articles = get_recent_article_feed({ limit: 100 }) %} {# full notation #} {% set articles = get_feed_items('article', { limit: 100, feed: 'recent' }) %}
Random product:
{% set random_product = get_random_product_feed({ limit: 1 }) %}

PHP :

Most recent 100 articles:
<?php
// ...

$articles = $this->get('szg_feed.elastic_search_items_provider')->getFeedItems('article', [
    'feed' => 'recent',
    'limit' => 100
]);

Random product:
<?php
// ...

$articles = $this->get('szg_feed.elastic_search_items_provider')->getFeedItems('product', [
    'feed' => 'random',
    'limit' => 1
]);

Options reference

Option Type Description Default
page int Current page number 1
limit int Items per page 100
category HasNodeInterface
Category
Page children
Category children
null
tags string
array
Taggable
Single tag
Tags collection
Object implements Taggable interface
null
tags_logic 'any'
'all'
'few'
at least one must fit
all must fit
33% must fit
'any'
excluded HasNodeInterface
Node
NodeTranslation
Category
Result
string NodeId
int NodeId
Array of elements to exclude from results. null
feed 'recent'
'random'
...custom_feed
Feed alias 'recent'
returnRawResultSet bool Return raw result set false
offsetOverride int null Override offset counted by page limit and page number by default | null
extra mixed You can pass any data to RelationDefinition and use it for custom query null

Defining custom feed types

Sort single field custom feed:

Configure custom feeds in config.yml, (*6)

kunstmaan_feed:
    custom: 
        title : 'desc'

Advanced custom feed:

1. Implement FeedElasticSearchInterface

Implement SZG\KunstmaanFeedBundle\Feed\ElasticSearch\Interfaces\FeedElasticSearchInterface., (*7)

<?php
// ...
class TitleDesc extends FeedElasticSearchInterface
{

   /**
    * @param QueryDefinition $queryDefinition
    */
   public function modifyQuery(QueryDefinition $queryDefinition)
   {
        $queryDefinition->getQuery()->addSort(['title' => ['order' => 'desc']]);
   }

}

2. Register custom feed service:

szg_feed.feed.title:
    class: AppBundle\Feed\TitleDesc
    tags:
      - { name: szg_feed.feed, alias: title }

Use custom feed

{% set articlesByTitle = get_title_article_feed() %}

The Versions

27/07 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Mateusz Dołęga

27/07 2018

3.2.2

3.2.2.0

  Sources   Download

MIT

The Requires

 

by Avatar Mateusz Dołęga

26/07 2018

3.2.1

3.2.1.0

  Sources   Download

MIT

The Requires

 

by Avatar Mateusz Dołęga

24/07 2018

3.2

3.2.0.0

  Sources   Download

MIT

The Requires

 

by Avatar Mateusz Dołęga

24/07 2018

3.1

3.1.0.0

  Sources   Download

MIT

The Requires

 

by Avatar Mateusz Dołęga

29/06 2018

3.0

3.0.0.0

  Sources   Download

MIT

The Requires

 

by Avatar Mateusz Dołęga

13/06 2018

2.1

2.1.0.0

  Sources   Download

MIT

The Requires

 

by Avatar Mateusz Dołęga

13/06 2018

2.0

2.0.0.0

  Sources   Download

MIT

The Requires

 

by Avatar Mateusz Dołęga

13/06 2018

1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

 

by Avatar Mateusz Dołęga

12/06 2018

1.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

by Avatar Mateusz Dołęga

19/04 2016

0.2

0.2.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Mateusz Dołęga

18/04 2016

0.2-alpha

0.2.0.0-alpha

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Mateusz Dołęga

18/04 2016

0.1-alpha

0.1.0.0-alpha

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Mateusz Dołęga