2017 © Pedro Peláez
 

library data-container

This class provides a way to easily iterate through the results of a query * or query builder. Or get the total results of the query/querybuilder * or retrieve a KNP_Pagination of the query/query builder

image

sideclick/data-container

This class provides a way to easily iterate through the results of a query * or query builder. Or get the total results of the query/querybuilder * or retrieve a KNP_Pagination of the query/query builder

  • Thursday, September 15, 2016
  • by RowanReid
  • Repository
  • 2 Watchers
  • 1 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

DataContainer

This class provides a way to easily work with the results of a Doctrine Query or QueryBuilder object as if it is an array. You may also use the class to retrive a KNP_Pagination object for the query or retrieve the query itself off the DataContainer., (*1)

Installation

Require via composer:, (*2)

require sideclick/data-container

Or add the following to the "require" section of composer.json, (*3)

"sideclick/data-container": "dev-master"

And then run a composer update, (*4)

Usage

Step 1 Use the class:

use Sideclick\Utils\DataContainer;

Step 2 Initiate an instance

For example in a controller:, (*5)

$em = $this->getDoctrine()->getManager();
$queryBuilder =
$em->getRepository('RoadToHealthBundle:User')
  ->createQueryBuilder('u');

$dataContainer = new DataContainer($queryBuilder);

Note that the DataContainer constructor can take a Doctrine QueryBuilder or Doctrine Query object as the parameter. Thereafter you may access the DataContainer object as an array. The following methods are also worth noting:, (*6)

// Return the Query Builder (will return NULL if a Doctrine Query was passed in the constructor)
$dataContainer->getQueryBuilder();

// Return a KnpPaginator object for the Query
$dataContainer->getPagination($page = 1, $countPerPage = 10);

And thats it!

The Versions

15/09 2016

dev-master

9999999-dev

This class provides a way to easily iterate through the results of a query * or query builder. Or get the total results of the query/querybuilder * or retrieve a KNP_Pagination of the query/query builder

  Sources   Download

MIT

The Requires

 

by Rowan Reid

15/09 2016

0.1.1

0.1.1.0

This class provides a way to easily iterate through the results of a query * or query builder. Or get the total results of the query/querybuilder * or retrieve a KNP_Pagination of the query/query builder

  Sources   Download

MIT

The Requires

 

by Rowan Reid

13/09 2016

v0.1.0

0.1.0.0

This class provides a way to easily iterate through the results of a query * or query builder. Or get the total results of the query/querybuilder * or retrieve a KNP_Pagination of the query/query builder

  Sources   Download

MIT

The Requires

 

by Rowan Reid