Define Person as Customisable class (Custom Field)

This commit is contained in:
Marc Ducobu 2014-11-07 19:16:47 +01:00
parent 2358e2a9bb
commit 395d9ef67b

View File

@ -30,6 +30,22 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
$loader->load('services.yml');
}
private function declarePersonAsCustomizable (ContainerBuilder $container)
{
$bundles = $container->getParameter('kernel.bundles');
if (!isset($bundles['ChillCustomFieldsBundle'])) {
throw new MissingBundleException('ChillCustomFieldsBundle');
}
$container->prependExtensionConfig('chill_custom_fields',
array('customizables_entities' =>
array(
array('class' => 'Chill\PersonBundle\Entity\Person', 'name' => 'PersonEntity')
)
)
);
}
public function prepend(ContainerBuilder $container)
{
$bundles = $container->getParameter('kernel.bundles');
@ -42,5 +58,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
$asseticConfig['bundles'][] = 'ChillPersonBundle';
$container->prependExtensionConfig('assetic',
array('bundles' => array('ChillPersonBundle')));
$this-> declarePersonAsCustomizable($container);
}
}