Thursday, 7 January 2016

Zend Framework 2 Paginator Hydrator and Basic MVC

Zend Framework 2 Paginator Hydrator and Basic MVC

Question: What is Hydrator in Zend Framework?
Hydration is a component which is used for populating an object from a set of data.


Question: Give and example of Hydrator in Zend Framework?
use \Zend\Stdlib\Hydrator;
$hydrator = new Hydrator\ArraySerializable();
$object = new ArrayObject(array());
$data = $hydrator->extract($object);



Question: What are different implements are available in Hydrator?
Zend\Stdlib\Hydrator\ArraySerializable
Zend\Stdlib\Hydrator\ClassMethods
Zend\Stdlib\Hydrator\ObjectProperty



Question: What are use of Filter in Hydrator?
The hydrator filters, allows you to manipulate the behavior. This is especially useful, if you want to extract() your objects to the userland and strip some internals.


Question: What is Zend\Paginator?
Zend\Paginator is a component for paginating collections of data and presenting that data to users.


Question: What are different adapter available for Zend\Paginator?
  1. ArrayAdapter
  2. DbSelect
  3. Iterator
  4. NullFill


Question: What are different Configuration available for Zend\Paginator?
  1. setCurrentPageNumber
  2. setItemCountPerPage
  3. setPageRange
  4. setView


Question: How to set the caching in Zend\Paginator?
$cacheObject = StorageFactory::adapterFactory('filesystem', array(
    'cache_dir' => '/tmp',
    'ttl'       => 3600,
    'plugins'   => array( 'serializer' ),
));
\Zend\Paginator\Paginator::setCache($cacheObject);



Question: What is New MVC Layer in Zend Framework2 ?
is a brand new MVC implementation focusing on performance and flexibility in ZF2.


Question: What are the components and sub-components in New MVC Layer of Zend Framework2 ?
Following are components are used.
  1. Zend\ServiceManager
  2. Zend\EventManager
  3. Zend\Http
  4. Zend\Stdlib\DispatchableInterface

Following are sub-components are used.
  1. Zend\Mvc\Router
  2. Zend\Http\PhpEnvironment
  3. Zend\Mvc\Controller
  4. Zend\Mvc\Service
  5. Zend\Mvc\View



Question: What is application structure of Zend Framework2 ?
application_root/
    config/
        application.config.php
        autoload/
            global.php
            local.php
            // etc.
    data/
    module/
    vendor/
    public/
        .htaccess
        index.php
    init_autoloader.php




Question: What is module structure of Zend Framework2 ?

module_root<named-after-module-namespace>/
    Module.php
    autoload_classmap.php
    autoload_function.php
    autoload_register.php
    config/
        module.config.php
    public/
        images/
        css/
        js/
    src/
        <module_namespace>/
            <code files="">
    test/
        phpunit.xml
        bootstrap.php
        <module_namespace>/
            <test code="" files="">
    view/
        <dir-named-after-module-namespace>/
            <dir-named-after-a-controller>/
                &lt;.phtml files&gt;</dir-named-after-a-controller></dir-named-after-module-namespace></test></module_namespace></code></module_namespace></named-after-module-namespace>