mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
serializer on accompanying course
Two new routes: * `GET /{_locale}/person/api/1.0/accompanying-course/{parcours_id}/show.json`: get a json representation for a course * `POST /{_locale}/person/api/1.0/accompanying-course/{parcours_id}/participation.json`: add a particitipation to course. Usage: `curl -v --cookie "PHPSESSID=fed98aa23e40cb36e630f84155aea3bb;" -X POST --data '{ "id": 481 }' http://localhost:8001/fr/person/api/1.0/accompanying-course/270/participation.json` Will add the person with id "481" to the course.
This commit is contained in:
@@ -38,7 +38,7 @@ use Chill\PersonBundle\Doctrine\DQL\AddressPart;
|
||||
*/
|
||||
class ChillPersonExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @param array $configs
|
||||
@@ -49,14 +49,14 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
{
|
||||
$configuration = new Configuration();
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
||||
|
||||
// set configuration for validation
|
||||
$container->setParameter('chill_person.validation.birtdate_not_before',
|
||||
$config['validation']['birthdate_not_after']);
|
||||
|
||||
|
||||
$this->handlePersonFieldsParameters($container, $config['person_fields']);
|
||||
$this->handleAccompanyingPeriodsFieldsParameters($container, $config['accompanying_periods_fields']);
|
||||
|
||||
|
||||
$container->setParameter('chill_person.allow_multiple_simultaneous_accompanying_periods',
|
||||
$config['allow_multiple_simultaneous_accompanying_periods']);
|
||||
|
||||
@@ -75,19 +75,20 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
$loader->load('services/repository.yaml');
|
||||
$loader->load('services/templating.yaml');
|
||||
$loader->load('services/alt_names.yaml');
|
||||
|
||||
$loader->load('services/serializer.yaml');
|
||||
|
||||
// load service advanced search only if configure
|
||||
if ($config['search']['search_by_phone'] != 'never') {
|
||||
$loader->load('services/search_by_phone.yaml');
|
||||
$container->setParameter('chill_person.search.search_by_phone',
|
||||
$config['search']['search_by_phone']);
|
||||
}
|
||||
|
||||
|
||||
if ($container->getParameter('chill_person.accompanying_period') !== 'hidden') {
|
||||
$loader->load('services/exports_accompanying_period.yaml');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
* @param $config
|
||||
@@ -97,9 +98,9 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
if (array_key_exists('enabled', $config)) {
|
||||
unset($config['enabled']);
|
||||
}
|
||||
|
||||
|
||||
$container->setParameter('chill_person.person_fields', $config);
|
||||
|
||||
|
||||
foreach ($config as $key => $value) {
|
||||
switch($key) {
|
||||
case 'accompanying_period':
|
||||
@@ -111,7 +112,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
* @param $config
|
||||
@@ -119,7 +120,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
private function handleAccompanyingPeriodsFieldsParameters(ContainerBuilder $container, $config)
|
||||
{
|
||||
$container->setParameter('chill_person.accompanying_period_fields', $config);
|
||||
|
||||
|
||||
foreach ($config as $key => $value) {
|
||||
switch($key) {
|
||||
case 'enabled':
|
||||
@@ -130,7 +131,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
* @throws MissingBundleException
|
||||
@@ -150,7 +151,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
* @throws MissingBundleException
|
||||
@@ -161,7 +162,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
$this->prependHomepageWidget($container);
|
||||
$this->prependDoctrineDQL($container);
|
||||
$this->prependCruds($container);
|
||||
|
||||
|
||||
//add person_fields parameter as global
|
||||
$chillPersonConfig = $container->getExtensionConfig($this->getAlias());
|
||||
$config = $this->processConfiguration(new Configuration(), $chillPersonConfig);
|
||||
@@ -179,7 +180,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
$container->prependExtensionConfig('twig', $twigConfig);
|
||||
|
||||
$this-> declarePersonAsCustomizable($container);
|
||||
|
||||
|
||||
//declare routes for person bundle
|
||||
$container->prependExtensionConfig('chill_main', array(
|
||||
'routing' => array(
|
||||
@@ -189,7 +190,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a widget "add a person" on the homepage, automatically
|
||||
*
|
||||
@@ -208,7 +209,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add role hierarchy.
|
||||
*
|
||||
@@ -225,7 +226,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add DQL function linked with person
|
||||
*
|
||||
@@ -234,7 +235,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
protected function prependDoctrineDQL(ContainerBuilder $container)
|
||||
{
|
||||
//add DQL function to ORM (default entity_manager)
|
||||
|
||||
|
||||
$container->prependExtensionConfig('doctrine', array(
|
||||
'orm' => array(
|
||||
'dql' => array(
|
||||
@@ -257,7 +258,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
|
Reference in New Issue
Block a user