From 36ed485f1a82c9a382b5ca63da60a73429f85921 Mon Sep 17 00:00:00 2001 From: Victor Häggqvist Date: Wed, 27 Jan 2016 01:27:35 +0100 Subject: update readme --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 15ac225..81ecd19 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ # Twig SortByField Extension [![](https://img.shields.io/travis/victorhaggqvist/Twig-sort-by-field.svg?style=flat)](https://travis-ci.org/victorhaggqvist/Twig-sort-by-field) A Twig Extension filter to sort an array of entries (objects or arrays) by an entry field. +Since version 0.1.5 Doctrine collections can be sorted as is with no need to manually extract the array first. + ## Install With composer composer require snilius/twig-sort-by-field -## Sample +## Usage The list could look like this, but obviously with more than one key per array. ```php @@ -34,6 +36,17 @@ $base = array( {% endfor %} ``` +For Symfony usage you'll want to add it as a service and tag it for Twig. + +```yml +# app/config/services.yml +services: + twig.extension.sortbyfield: + class: Snilius\Twig\SortByFieldExtension + tags: + - { name: twig.extension } +``` + ## License Copyright 2015 Victor Häggqvist -- cgit v1.2.3