symfony2admingenerator / AdmingeneratorGeneratorBundle

(old-legacy) Admingenerator for Symfony2, parse generator.yml files to build classes
http://symfony2admingenerator.org/
MIT License
360 stars 125 forks source link

v2.0 features #779

Closed ioleo closed 10 years ago

ioleo commented 10 years ago

This PR introduces new features:

This PR also introduces some changes:

This PR is still not complete, there are some TODOs:

This PR has only been tested for Doctrine ORM! This needs testing for DoctrineODM and Propel.

bobvandevijver commented 10 years ago

:+1:!

I will try this one soon! I do not think that will be this month, but you never know...

ioleo commented 10 years ago

@bobvandevijver probably today I'll be publishing a "DemoProject", so everyone can quickly and easily preview new features

ioleo commented 10 years ago

@bobvandevijver I've just published symfony2admingenerator/symfony2-admingenerator-demo-edition.

To use the demo, simply CLONE it. Then create localhost database for this parameters:

app/config/parameters.yml.dist

or change the parameters in app/config/parameters.yml

Then "cd" into demo root dir and do:

these should automatically be done with composer install, but if they fail for any reason:

then type these to create database tables and fill them with data

And then do php app/console server:run

And go to http://127.0.0.1/app_dev.php in your browser.

Note: the demo is not complete yet. But it will be updated.

ioleo commented 10 years ago

@bobvandevijver The demo project so far:

Equal, Not Equal, Greater Than, Greater Than or Equal, Less Than, Less Than or Equal, Like, Not Like, Contains, Not Contains

eg. Like is only for TEXT and ARRAY's (becouse array mapping is a serialized text)

eg2. Greater/Less Than operations are only for numeric and date fields

ioleo commented 10 years ago

@bobvandevijver Packagist does not allow submitting the same git repo URL twice, so, I needed to create new repositories for both GeneratorBundle and FormExtensionsBundle, becouse I renamed the packagist packages:

Note: New (unstable) repositories and packagist names:

  • AdmingeneratorGeneratorBundle github: git@github.com:symfony2admingenerator/GeneratorBundle.git packagist: "symfony2admingenerator/generator-bundle"
  • AdmingeneratorFormExtensionsBundle github: git@github.com:symfony2admingenerator/FormExtensionsBundle.git packagist: "symfony2admingenerator/form-extensions-bundle"

Note: Old (legacy) repositories and packagist names:

  • AdmingeneratorGeneratorBundle github: git@github.com:symfony2admingenerator/AdmingeneratorGeneratorBundle.git packagist: "cedriclombardot/admingenerator-generator-bundle"
  • AvocodeFormExtensionsBundle github: git@github.com:symfony2admingenerator/AvocodeFormExtensionsBundle.git packagist: "avocode/form-extensions-bundle"

Warning: These repositories are left for legacy users and are NOT COMPATIBLE with this demo.

ioleo commented 10 years ago

@bobvandevijver also created an updated version of UserBundle:

New (unstable) repository:

  • AdmingeneratorUserBundle github: git@github.com:symfony2admingenerator/UserBundle.git packagist: "symfony2admingenerator/user-bundle"

Old (legacy) repository:

  • AdmingeneratorUserBundle github: git@github.com:symfony2admingenerator/AdmingeneratorUserBundle.git packagist: "cedriclombardot/admingenerator-user-bundle"
ioleo commented 10 years ago

Added new features to GeneratorBundle:

params:
  fields:
    balance:
      getter: balance
      filterType: number
builders:
  list:
    params:
      display: [ balance ]
  filters:
    params:
      display: [ balance ]

Will generate handleBalanceSort and handleBalanceFilter methods in BaseListBuilder.

You can overwrite these methods and apply custom query filter/sort logic.

Eg. you can:

Note: this is just a sketch, this DQL is probably wrong :P

 * `incomings`: `SELECT inc.amount FROM IncomingTransfer inc WHERE inc.account_id = q.id`
 * `outgoings`: `SELECT out.amount FROM OutgoingTransfer out WHERE out.account_id = q.id`
 * `balance`: `SUM (incomings, outgoings)` (this assumes outgoings is negative)