Giter VIP home page Giter VIP logo

zf-smartcrud's Introduction

SmartCrud for Zend Framework

Master: Build Status Dev-Master: Build Status

Module providing a SmartCrud for working with the Zend Framework 2 MVC layer.

Installation

Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.

php composer.phar require phpro/zf-smartcrud
# (When asked for a version, type `dev-master`)

Then add Phpro\SmartCrud to your config/application.config.php.

Installation without composer is not officially supported and requires you to manually install all dependencies that are listed in composer.json

Documentation

Configuration

It is possible to configure the smartcrud services on multiple places. e.g. For the list service, the configuration will be merged as followed:

  • phpro-smartcrud-service['default']
  • phpro-smartcrud-service['default-list']
  • service_manager['my-custom-smartcrud-service']['default']
  • service_manager['my-custom-smartcrud-service']['list']

This means it is possible to specify some default configuration and overwrite it for custom services.

SmartCrud Configuration

Gateways

It is possible to configure multiple data-source gateways. Those gateways are being used by the services to load and save the data.

'phpro-smartcrud-gateway' => array(
    'smartcrud.gateway.doctrine.default' => array(
        'type' => 'PhproSmartCrud\Gateway\DoctrineCrudGateway',
        'options' => array(
            'object_manager' => 'doctrine.documentmanager.odm_default',
        ),
    )
),

Services

'phpro-smartcrud-service' => array(
    'SmartCrudServiceKey' => array(
        'default' => array(
            'gateway' => 'smartcrud.gateway.doctrine.default',
            'entity-class' => 'entity-key',
            'form' => 'form-key',
            'listeners' => []
        ),
    ),
),
List Service

The list service has some extra configurable options. It is required to specify a paginator and it is optional to add a query provider to filter / sort lists.

Paginator

'phpro-smartcrud-service' => array(
    'default-list' => array(
        'options' => array(
            'paginator' => array(
                'adapter_class' => '\Zend\Paginator\Adapter\ArrayAdapter',
                'page_size' => 50,
                'page_key' => 'page',
            ),
        )
    )
),

Query Provider

A query provider implements the QueryProviderInterface. It is possible to add your own query provider to a List Service:

'phpro-smartcrud-service' => array(
    'default-list' => array(
        'options' => array(
            'query-provider' => 'servicemanager.key.my-custom-query-provider',
        ),
    )
),
listeners:

Array of service manager keys, which return EventListenerAggregateInterface. These listeners can be used listen to SmartCrud events on entities.

Available SmartCrud events:
CrudEvent::BEFORE_LIST
CrudEvent::AFTER_LIST
CrudEvent::BEFORE_DATA_VALIDATION
CrudEvent::BEFORE_CREATE
CrudEvent::AFTER_CREATE
CrudEvent::INVALID_CREATE
CrudEvent::BEFORE_READ
CrudEvent::AFTER_READ
CrudEvent::BEFORE_UPDATE
CrudEvent::AFTER_UPDATE
CrudEvent::INVALID_UPDATE
CrudEvent::BEFORE_DELETE
CrudEvent::AFTER_DELETE
CrudEvent::INVALID_DELETE
CrudEvent::BEFORE_VALIDATE
CrudEvent::AFTER_VALIDATE
CrudEvent::FORM_READY

Controllers

'phpro-smartcrud-controller' => array(
    'SmartCrudControllerKey' => array(
        'controller' => 'Phpro\SmartCrud\Controller\CrudController',
        'identifier-name' => 'identifier',
        'smart-service' => 'SmartCrudServiceKey',
        'view-builder' => 'Phpro\SmartCrud\View\Model\ViewModelBuilder',
        'view-path' => 'path',
    ),
),

More coming soon!

zf-smartcrud's People

Contributors

mar-e-o avatar tlambeir avatar veewee avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.