sonata-project/SonataDoctrinePhpcrAdminBundle — pull request #46 by sjopet (2012-08-06 09:30:06+00:00)
Title: Fixed sonata_type_collection and others

I added the widgets for a couple of form types including sonata_type_collection to the form_admin_fields.html.twig template.

Changed the template references from SonataDoctrineORMAdminBundle to SonataDoctrinePHPCRAdminBundle in a the CRUD edit templates. The file names should be changed aswell but maybe a solution where both bundles use the same CRUD:edit templates is better since there are no functional differences.

I updated the fixFieldDescription method in the FormContractor class to work with the referrersMappings property of the MetaData class.

I added a condition in the FieldDescription class to manualy set a mapping type for the referrers associationMapping.

I tested it with a referrers relation between a Page and Route using a sonata_type_collection it works fine but only if you set the admin_code manually in the configureFormFields method of the PageAdmin:

->with('Routes')
->add('routes',
'sonata_type_collection',
array('label' => 'Routes'),
array('edit' => 'inline', 'inline' => 'table', 'admin_code' => 'netvlies_admin.admin.route'))

Because the TargetEntity isn't supplied in the relation mapping and I wasn't sure how to extract the correct class (Route) from the metadata to fetch it's Admin class from the AdminPool.

I know my code needs work and i have not tested it with all types but at least it's a start and it should not interfere with or break any existing code.