Developed with love by KnpLabs Hire us for your project!
15

Symfony-FastEntityBundle

by TheDevilOnLine

Improves performance for simple dropdowns generated from a list of Entities

DotCommerce's FastEntityBundle

Fast entity bundle for Symfony 2, used to generate dropdowns from entities faster than the default 'entity' formtype. To do this a new form type has to be generated for the entity used in the dropdown

Usage

You need to use the command line tool from Symfony (app/console) to generate the new form types. The syntax is simple:

$ app/console dotcommerce:generate:fastentity BundleName[:EntityName] [FieldName]
  • BundleName is the name of you Bundle (i.e. MyBundle)
  • EntityName (optional) is the name of your entity (i.e. MyEntity), if not defined it will generate form types for all the entities in the bundle
  • FieldName (optional) the name of the field which is displayed in the dropdown, if not defined it will try to use the field 'name'

So if I want to generate a fast form type, for my entity Customer which is in my StoreBundle and I want to display the lastname of the customer in the dropdown, I need to use command:

$ app/console dotcommerce:generate:fastentity StoreBundle:Customer lastname

To use the newly generated form type you have to specify it manualy in a Form. The name for your new formtype is the entityname in lowercase prepended by the word 'fast', i.e. for the above generated Customer entity, the formtype is called 'fastcustomer'.

Last updates

2012-12-07
- First public version

Installation

Pretty simple with composer, add:

{
    require: {
        "dotcommerce/fastentitybundle": "dev-master"
    }
}

If you use a deps file, add:

[DotCommerceFastEntityBundle]
    git://github.com/TheDevilOnLine/Symfony-FastEntityBundle.git

Or if you want to clone the repos:

git clone git://github.com/TheDevilOnLine/Symfony-FastEntityBundle.git vendor/dotcommerce/fastentitybundle/DotCommerce/FastEntityBundle

Add the namespaces to your autoloader unless you are using composer

<?php
// File: app/autoload.php
$loader->registerNamespaces(array(
    'DotCommerce\\FastEntityBundle'      => __DIR__.'/../vendor/dotcommerce/fastentitybundle/DotCommerce/FastEntityBundle',
    // ...
));

Add DotCommerceFastEntityBundle to your application kernel

<?php
    // File: app/AppKernel.php
    public function registerBundles()
    {
        return array(
            // ...
            new DotCommerce\FastEntityBundle\DotCommerceFastEntityBundle(),
            // ...
        );
    }
Copyright (c) 2012 DotCommerce

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
dot_commerce_fast_entity:  []
  • Make code compatible with php 5.3
    By TheDevilOnLine, 4 years ago
  • Update README.md - Fixed typo
    By TheDevilOnLine, 4 years ago
  • Mental note to self: Do not add an extra , to the end of an array in a json file!
    By TheDevilOnLine, 4 years ago
  • Added authors to composer.json
    By TheDevilOnLine, 4 years ago
  • Updated README.md with installation instructions
    By TheDevilOnLine, 4 years ago
  • Use forward slashes for directory's
    By TheDevilOnLine, 4 years ago
  • Have to do it like this (although the directory structure gets weird) to make autoload work!
    By TheDevilOnLine, 4 years ago
  • Don't mix tabs and spaces (converted to all spaces)
    By TheDevilOnLine, 4 years ago
  • Getting there (tweaking the composer.json)
    By TheDevilOnLine, 4 years ago
  • New and improved composer.json
    By TheDevilOnLine, 4 years ago
  • Merge branch 'master' of https://github.com/TheDevilOnLine/Symfony-FastEntityBundle
    By TheDevilOnLine, 4 years ago
  • Fixed composer.json
    By TheDevilOnLine, 4 years ago
  • Fixed composer.json
    By TheDevilOnLine, 4 years ago
  • Fixed README.md
    By TheDevilOnLine, 4 years ago
  • First public version
    By TheDevilOnLine, 4 years ago