mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
move bundle to root dir for inclusion in packagist refs #259
This commit is contained in:
parent
8011746b26
commit
e987a891a7
@ -1,7 +0,0 @@
|
|||||||
<IfModule mod_authz_core.c>
|
|
||||||
Require all denied
|
|
||||||
</IfModule>
|
|
||||||
<IfModule !mod_authz_core.c>
|
|
||||||
Order deny,allow
|
|
||||||
Deny from all
|
|
||||||
</IfModule>
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle;
|
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
|
||||||
use Chill\CustomFieldsBundle\DependencyInjection\CustomFieldCompilerPass;
|
|
||||||
|
|
||||||
class ChillCustomFieldsBundle extends Bundle
|
|
||||||
{
|
|
||||||
public function build(\Symfony\Component\DependencyInjection\ContainerBuilder $container)
|
|
||||||
{
|
|
||||||
parent::build($container);
|
|
||||||
$container->addCompilerPass(new CustomFieldCompilerPass());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,224 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Controller;
|
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
|
|
||||||
use Chill\CustomFieldsBundle\Entity\Adress;
|
|
||||||
use Chill\CustomFieldsBundle\Form\AdressType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adress controller.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class AdressController extends Controller
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lists all Adress entities.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function indexAction()
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entities = $em->getRepository('ChillCustomFieldsBundle:Adress')->findAll();
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:Adress:index.html.twig', array(
|
|
||||||
'entities' => $entities,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Creates a new Adress entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function createAction(Request $request)
|
|
||||||
{
|
|
||||||
$entity = new Adress();
|
|
||||||
$form = $this->createCreateForm($entity);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$em->persist($entity);
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('adress_show', array('id' => $entity->getId())));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:Adress:new.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'form' => $form->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to create a Adress entity.
|
|
||||||
*
|
|
||||||
* @param Adress $entity The entity
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createCreateForm(Adress $entity)
|
|
||||||
{
|
|
||||||
$form = $this->createForm(new AdressType(), $entity, array(
|
|
||||||
'action' => $this->generateUrl('adress_create'),
|
|
||||||
'method' => 'POST',
|
|
||||||
));
|
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Create'));
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a form to create a new Adress entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function newAction()
|
|
||||||
{
|
|
||||||
$entity = new Adress();
|
|
||||||
$form = $this->createCreateForm($entity);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:Adress:new.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'form' => $form->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds and displays a Adress entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function showAction($id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:Adress')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find Adress entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:Adress:show.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a form to edit an existing Adress entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function editAction($id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:Adress')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find Adress entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$editForm = $this->createEditForm($entity);
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:Adress:edit.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'edit_form' => $editForm->createView(),
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to edit a Adress entity.
|
|
||||||
*
|
|
||||||
* @param Adress $entity The entity
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createEditForm(Adress $entity)
|
|
||||||
{
|
|
||||||
$form = $this->createForm(new AdressType(), $entity, array(
|
|
||||||
'action' => $this->generateUrl('adress_update', array('id' => $entity->getId())),
|
|
||||||
'method' => 'PUT',
|
|
||||||
));
|
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Update'));
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Edits an existing Adress entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function updateAction(Request $request, $id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:Adress')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find Adress entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
$editForm = $this->createEditForm($entity);
|
|
||||||
$editForm->handleRequest($request);
|
|
||||||
|
|
||||||
if ($editForm->isValid()) {
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('adress_edit', array('id' => $id)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:Adress:edit.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'edit_form' => $editForm->createView(),
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Deletes a Adress entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function deleteAction(Request $request, $id)
|
|
||||||
{
|
|
||||||
$form = $this->createDeleteForm($id);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:Adress')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find Adress entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$em->remove($entity);
|
|
||||||
$em->flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('adress'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to delete a Adress entity by id.
|
|
||||||
*
|
|
||||||
* @param mixed $id The entity id
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createDeleteForm($id)
|
|
||||||
{
|
|
||||||
return $this->createFormBuilder()
|
|
||||||
->setAction($this->generateUrl('adress_delete', array('id' => $id)))
|
|
||||||
->setMethod('DELETE')
|
|
||||||
->add('submit', 'submit', array('label' => 'Delete'))
|
|
||||||
->getForm()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,226 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Controller;
|
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
|
|
||||||
use Chill\CustomFieldsBundle\Entity\BlopEntity2;
|
|
||||||
use Chill\CustomFieldsBundle\Form\BlopEntity2Type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BlopEntity2 controller.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class BlopEntity2Controller extends Controller
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lists all BlopEntity2 entities.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function indexAction()
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entities = $em->getRepository('ChillCustomFieldsBundle:BlopEntity2')->findAll();
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:BlopEntity2:index.html.twig', array(
|
|
||||||
'entities' => $entities,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Creates a new BlopEntity2 entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function createAction(Request $request)
|
|
||||||
{
|
|
||||||
$entity = new BlopEntity2();
|
|
||||||
$form = $this->createCreateForm($entity);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$em->persist($entity);
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('blopentity2_show', array('id' => $entity->getId())));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:BlopEntity2:new.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'form' => $form->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to create a BlopEntity2 entity.
|
|
||||||
*
|
|
||||||
* @param BlopEntity2 $entity The entity
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createCreateForm(BlopEntity2 $entity)
|
|
||||||
{
|
|
||||||
$form = $this->createForm(new BlopEntity2Type(), $entity, array(
|
|
||||||
'action' => $this->generateUrl('blopentity2_create'),
|
|
||||||
'method' => 'POST',
|
|
||||||
'em' => $this->getDoctrine()->getManager(),
|
|
||||||
));
|
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Create'));
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a form to create a new BlopEntity2 entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function newAction()
|
|
||||||
{
|
|
||||||
$entity = new BlopEntity2();
|
|
||||||
$form = $this->createCreateForm($entity);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:BlopEntity2:new.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'form' => $form->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds and displays a BlopEntity2 entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function showAction($id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity2')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find BlopEntity2 entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:BlopEntity2:show.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a form to edit an existing BlopEntity2 entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function editAction($id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity2')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find BlopEntity2 entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$editForm = $this->createEditForm($entity);
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:BlopEntity2:edit.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'edit_form' => $editForm->createView(),
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to edit a BlopEntity2 entity.
|
|
||||||
*
|
|
||||||
* @param BlopEntity2 $entity The entity
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createEditForm(BlopEntity2 $entity)
|
|
||||||
{
|
|
||||||
$form = $this->createForm(new BlopEntity2Type(), $entity, array(
|
|
||||||
'action' => $this->generateUrl('blopentity2_update', array('id' => $entity->getId())),
|
|
||||||
'method' => 'PUT',
|
|
||||||
'em' => $this->getDoctrine()->getManager(),
|
|
||||||
));
|
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Update'));
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Edits an existing BlopEntity2 entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function updateAction(Request $request, $id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity2')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find BlopEntity2 entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
$editForm = $this->createEditForm($entity);
|
|
||||||
$editForm->handleRequest($request);
|
|
||||||
|
|
||||||
if ($editForm->isValid()) {
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('blopentity2_edit', array('id' => $id)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:BlopEntity2:edit.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'edit_form' => $editForm->createView(),
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Deletes a BlopEntity2 entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function deleteAction(Request $request, $id)
|
|
||||||
{
|
|
||||||
$form = $this->createDeleteForm($id);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity2')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find BlopEntity2 entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$em->remove($entity);
|
|
||||||
$em->flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('blopentity2'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to delete a BlopEntity2 entity by id.
|
|
||||||
*
|
|
||||||
* @param mixed $id The entity id
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createDeleteForm($id)
|
|
||||||
{
|
|
||||||
return $this->createFormBuilder()
|
|
||||||
->setAction($this->generateUrl('blopentity2_delete', array('id' => $id)))
|
|
||||||
->setMethod('DELETE')
|
|
||||||
->add('submit', 'submit', array('label' => 'Delete'))
|
|
||||||
->getForm()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,291 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Controller;
|
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
|
|
||||||
use Chill\CustomFieldsBundle\Entity\BlopEntity;
|
|
||||||
use Chill\CustomFieldsBundle\Form\BlopEntityType;
|
|
||||||
use Chill\CustomFieldsBundle\Form\AdressType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BlopEntity controller.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class BlopEntityController extends Controller
|
|
||||||
{
|
|
||||||
|
|
||||||
public function addNewManyToOneAction($id, $key)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$customFields = $em->getRepository('ChillCustomFieldsBundle:CustomField')
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
$customFieldsLablels = array_map(
|
|
||||||
function($e) { return $e->getLabel(); },
|
|
||||||
$customFields);
|
|
||||||
|
|
||||||
$customFieldsByLabel = array_combine($customFieldsLablels, $customFields);
|
|
||||||
|
|
||||||
if (array_key_exists($key,$customFieldsByLabel)) {
|
|
||||||
$customFieldConfig = $customFieldsByLabel[$key];
|
|
||||||
if($customFieldConfig->getType() === 'OneToMany(Adress)') {
|
|
||||||
$manyToOneEntity = new AdressType();
|
|
||||||
$form = $this->createCreateForm($manyToOneEntity);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$em->persist($manyToOneEntity);
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
$blopEntity = $this->om
|
|
||||||
->getRepository('ChillCustomFieldsBundle:CustomField')
|
|
||||||
->findOneById($id);
|
|
||||||
|
|
||||||
$blopEntityCustomFieldArray = json_decode($blopEntity->getCustomField());
|
|
||||||
$blopEntityCustomFieldArray[$key][] = $manyToOneEntity->getId();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// PAS MANY TO ONE
|
|
||||||
throw new Exception("Error Processing Request", 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// PAS RENSEIGNE COMME CF
|
|
||||||
throw new Exception("Error Processing Request", 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lists all BlopEntity entities.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function indexAction()
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entities = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->findAll();
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:BlopEntity:index.html.twig', array(
|
|
||||||
'entities' => $entities,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function cfSetAction($id,$key,$value)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->find($id);
|
|
||||||
echo $entity->cfSet($key,$value);
|
|
||||||
var_dump($entity->getCustomField());
|
|
||||||
$em->persist($entity);
|
|
||||||
$em->flush();
|
|
||||||
return null;//$entity->cfSet($key,$value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function cfGetAction($id,$key)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->find($id);
|
|
||||||
echo $entity->cfGet($key);
|
|
||||||
return null;//return $entity->cfGet($key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new BlopEntity entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function createAction(Request $request)
|
|
||||||
{
|
|
||||||
$entity = new BlopEntity();
|
|
||||||
$form = $this->createCreateForm($entity);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$em->persist($entity);
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('blopentity_show', array('id' => $entity->getId())));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:BlopEntity:new.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'form' => $form->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to create a BlopEntity entity.
|
|
||||||
*
|
|
||||||
* @param BlopEntity $entity The entity
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createCreateForm(BlopEntity $entity)
|
|
||||||
{
|
|
||||||
$form = $this->createForm(new BlopEntityType(), $entity, array(
|
|
||||||
'action' => $this->generateUrl('blopentity_create'),
|
|
||||||
'method' => 'POST',
|
|
||||||
'em' => $this->getDoctrine()->getManager(),
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Create'));
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a form to create a new BlopEntity entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function newAction()
|
|
||||||
{
|
|
||||||
$entity = new BlopEntity();
|
|
||||||
$form = $this->createCreateForm($entity);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:BlopEntity:new.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'form' => $form->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds and displays a BlopEntity entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function showAction($id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find BlopEntity entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:BlopEntity:show.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a form to edit an existing BlopEntity entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function editAction($id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find BlopEntity entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$editForm = $this->createEditForm($entity);
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:BlopEntity:edit.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'edit_form' => $editForm->createView(),
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to edit a BlopEntity entity.
|
|
||||||
*
|
|
||||||
* @param BlopEntity $entity The entity
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createEditForm(BlopEntity $entity)
|
|
||||||
{
|
|
||||||
$form = $this->createForm(new BlopEntityType(), $entity, array(
|
|
||||||
'action' => $this->generateUrl('blopentity_update', array('id' => $entity->getId())),
|
|
||||||
'method' => 'PUT',
|
|
||||||
'em' => $this->getDoctrine()->getManager(),
|
|
||||||
));
|
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Update'));
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Edits an existing BlopEntity entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function updateAction(Request $request, $id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find BlopEntity entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
$editForm = $this->createEditForm($entity);
|
|
||||||
$editForm->handleRequest($request);
|
|
||||||
|
|
||||||
if ($editForm->isValid()) {
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('blopentity_edit', array('id' => $id)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:BlopEntity:edit.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'edit_form' => $editForm->createView(),
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Deletes a BlopEntity entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function deleteAction(Request $request, $id)
|
|
||||||
{
|
|
||||||
$form = $this->createDeleteForm($id);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find BlopEntity entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$em->remove($entity);
|
|
||||||
$em->flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('blopentity'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to delete a BlopEntity entity by id.
|
|
||||||
*
|
|
||||||
* @param mixed $id The entity id
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createDeleteForm($id)
|
|
||||||
{
|
|
||||||
return $this->createFormBuilder()
|
|
||||||
->setAction($this->generateUrl('blopentity_delete', array('id' => $id)))
|
|
||||||
->setMethod('DELETE')
|
|
||||||
->add('submit', 'submit', array('label' => 'Delete'))
|
|
||||||
->getForm()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,247 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Controller;
|
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
|
|
||||||
use Chill\CustomFieldsBundle\Entity\CustomField;
|
|
||||||
use Chill\CustomFieldsBundle\Form\CustomFieldType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CustomField controller.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class CustomFieldController extends Controller
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lists all CustomField entities.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function indexAction()
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entities = $em->getRepository('ChillCustomFieldsBundle:CustomField')->findAll();
|
|
||||||
|
|
||||||
//prepare form for new custom type
|
|
||||||
$fieldChoices = array();
|
|
||||||
foreach ($this->get('chill.custom_field_compiler')->getAllFields()
|
|
||||||
as $key => $customType) {
|
|
||||||
$fieldChoices[$key] = $customType->getName();
|
|
||||||
}
|
|
||||||
$form = $this->get('form.factory')
|
|
||||||
->createNamedBuilder(null, 'form', null, array(
|
|
||||||
'method' => 'GET',
|
|
||||||
'action' => $this->generateUrl('customfield_new'),
|
|
||||||
'csrf_protection' => false
|
|
||||||
))
|
|
||||||
->add('type', 'choice', array(
|
|
||||||
'choices' => $fieldChoices
|
|
||||||
))
|
|
||||||
->getForm();
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:CustomField:index.html.twig', array(
|
|
||||||
'entities' => $entities,
|
|
||||||
'form' => $form->createView()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new CustomField entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function createAction(Request $request)
|
|
||||||
{
|
|
||||||
$entity = new CustomField();
|
|
||||||
$form = $this->createCreateForm($entity, $request->query->get('type', null));
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$em->persist($entity);
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('customfield_show', array('id' => $entity->getId())));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:CustomField:new.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'form' => $form->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to create a CustomField entity.
|
|
||||||
*
|
|
||||||
* @param CustomField $entity The entity
|
|
||||||
* @param string
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createCreateForm(CustomField $entity, $type)
|
|
||||||
{
|
|
||||||
$form = $this->createForm('custom_field_choice', $entity, array(
|
|
||||||
'action' => $this->generateUrl('customfield_create',
|
|
||||||
array('type' => $type)),
|
|
||||||
'method' => 'POST',
|
|
||||||
'type' => $type
|
|
||||||
));
|
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Create'));
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a form to create a new CustomField entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function newAction(Request $request)
|
|
||||||
{
|
|
||||||
$entity = new CustomField();
|
|
||||||
$form = $this->createCreateForm($entity, $request->query->get('type'));
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:CustomField:new.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'form' => $form->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds and displays a CustomField entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function showAction($id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:CustomField')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find CustomField entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:CustomField:show.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a form to edit an existing CustomField entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function editAction($id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:CustomField')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find CustomField entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$editForm = $this->createEditForm($entity, $entity->getType());
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:CustomField:edit.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'edit_form' => $editForm->createView(),
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to edit a CustomField entity.
|
|
||||||
*
|
|
||||||
* @param CustomField $entity The entity
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createEditForm(CustomField $entity, $type)
|
|
||||||
{
|
|
||||||
$form = $this->createForm('custom_field_choice', $entity, array(
|
|
||||||
'action' => $this->generateUrl('customfield_update', array('id' => $entity->getId())),
|
|
||||||
'method' => 'PUT',
|
|
||||||
'type' => $type
|
|
||||||
));
|
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Update'));
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Edits an existing CustomField entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function updateAction(Request $request, $id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:CustomField')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find CustomField entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
$editForm = $this->createEditForm($entity);
|
|
||||||
$editForm->handleRequest($request);
|
|
||||||
|
|
||||||
if ($editForm->isValid()) {
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('customfield_edit', array('id' => $id)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:CustomField:edit.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'edit_form' => $editForm->createView(),
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Deletes a CustomField entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function deleteAction(Request $request, $id)
|
|
||||||
{
|
|
||||||
$form = $this->createDeleteForm($id);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:CustomField')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find CustomField entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$em->remove($entity);
|
|
||||||
$em->flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('customfield'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to delete a CustomField entity by id.
|
|
||||||
*
|
|
||||||
* @param mixed $id The entity id
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createDeleteForm($id)
|
|
||||||
{
|
|
||||||
return $this->createFormBuilder()
|
|
||||||
->setAction($this->generateUrl('customfield_delete', array('id' => $id)))
|
|
||||||
->setMethod('DELETE')
|
|
||||||
->add('submit', 'submit', array('label' => 'Delete'))
|
|
||||||
->getForm()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,224 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Controller;
|
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
|
|
||||||
use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
|
|
||||||
use Chill\CustomFieldsBundle\Form\CustomFieldsGroupType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CustomFieldsGroup controller.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class CustomFieldsGroupController extends Controller
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lists all CustomFieldsGroup entities.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function indexAction()
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entities = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->findAll();
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:index.html.twig', array(
|
|
||||||
'entities' => $entities,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Creates a new CustomFieldsGroup entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function createAction(Request $request)
|
|
||||||
{
|
|
||||||
$entity = new CustomFieldsGroup();
|
|
||||||
$form = $this->createCreateForm($entity);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$em->persist($entity);
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('customfieldsgroup_show', array('id' => $entity->getId())));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:new.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'form' => $form->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to create a CustomFieldsGroup entity.
|
|
||||||
*
|
|
||||||
* @param CustomFieldsGroup $entity The entity
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createCreateForm(CustomFieldsGroup $entity)
|
|
||||||
{
|
|
||||||
$form = $this->createForm('custom_fields_group', $entity, array(
|
|
||||||
'action' => $this->generateUrl('customfieldsgroup_create'),
|
|
||||||
'method' => 'POST',
|
|
||||||
));
|
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Create'));
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a form to create a new CustomFieldsGroup entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function newAction()
|
|
||||||
{
|
|
||||||
$entity = new CustomFieldsGroup();
|
|
||||||
$form = $this->createCreateForm($entity);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:new.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'form' => $form->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds and displays a CustomFieldsGroup entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function showAction($id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:show.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a form to edit an existing CustomFieldsGroup entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function editAction($id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$editForm = $this->createEditForm($entity);
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:edit.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'edit_form' => $editForm->createView(),
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to edit a CustomFieldsGroup entity.
|
|
||||||
*
|
|
||||||
* @param CustomFieldsGroup $entity The entity
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createEditForm(CustomFieldsGroup $entity)
|
|
||||||
{
|
|
||||||
$form = $this->createForm('custom_fields_group', $entity, array(
|
|
||||||
'action' => $this->generateUrl('customfieldsgroup_update', array('id' => $entity->getId())),
|
|
||||||
'method' => 'PUT',
|
|
||||||
));
|
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Update'));
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Edits an existing CustomFieldsGroup entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function updateAction(Request $request, $id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
$editForm = $this->createEditForm($entity);
|
|
||||||
$editForm->handleRequest($request);
|
|
||||||
|
|
||||||
if ($editForm->isValid()) {
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('customfieldsgroup_edit', array('id' => $id)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:edit.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'edit_form' => $editForm->createView(),
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Deletes a CustomFieldsGroup entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function deleteAction(Request $request, $id)
|
|
||||||
{
|
|
||||||
$form = $this->createDeleteForm($id);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$entity = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$em->remove($entity);
|
|
||||||
$em->flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('customfieldsgroup'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to delete a CustomFieldsGroup entity by id.
|
|
||||||
*
|
|
||||||
* @param mixed $id The entity id
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createDeleteForm($id)
|
|
||||||
{
|
|
||||||
return $this->createFormBuilder()
|
|
||||||
->setAction($this->generateUrl('customfieldsgroup_delete', array('id' => $id)))
|
|
||||||
->setMethod('DELETE')
|
|
||||||
->add('submit', 'submit', array('label' => 'Delete'))
|
|
||||||
->getForm()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
|
|
||||||
class DefaultController extends Controller
|
|
||||||
{
|
|
||||||
public function indexAction($name)
|
|
||||||
{
|
|
||||||
return $this->render('ChillCustomFieldsBundle:Default:index.html.twig', array('name' => $name));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\CustomFields;
|
|
||||||
|
|
||||||
use Chill\CustomFieldsBundle\CustomFields\CustomFieldInterface;
|
|
||||||
use Chill\CustomFieldsBundle\Entity\CustomField;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldDataTransformer;
|
|
||||||
use Chill\CustomFieldsBundle\Form\AdressType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description of CustomFieldAddress
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class CustomFieldAddress implements CustomFieldInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var EntityManagerInterface
|
|
||||||
*/
|
|
||||||
public $om;
|
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $om)
|
|
||||||
{
|
|
||||||
$this->om = $om;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
|
|
||||||
{
|
|
||||||
$builder->add(
|
|
||||||
$builder->create('address', 'entity', array(
|
|
||||||
'class' => 'ChillCustomFieldsBundle:Adress',
|
|
||||||
'multiple' => true,
|
|
||||||
'expanded' => true
|
|
||||||
)
|
|
||||||
)->addModelTransformer(new CustomFieldDataTransformer(
|
|
||||||
$this,
|
|
||||||
$customField)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'CF address';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function render($value, CustomField $customField)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildOptionsForm(FormBuilderInterface $builder)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function deserialize($serialized, CustomField $customField)
|
|
||||||
{
|
|
||||||
// if ($serialized === NULL) {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return $this->om->getRepository('ChillCustomFieldsBundle:Adress')
|
|
||||||
// ->find($serialized);
|
|
||||||
|
|
||||||
return $this->om->getRepository('ChillCustomFieldsBundle:Adress')
|
|
||||||
->findBy(array('id' => $serialized));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param \Chill\CustomFieldsBundle\Entity\Adress $value
|
|
||||||
* @param CustomField $customField
|
|
||||||
* @return type
|
|
||||||
*/
|
|
||||||
public function serialize($value, CustomField $customField)
|
|
||||||
{
|
|
||||||
$arrayId = array();
|
|
||||||
|
|
||||||
foreach($value as $address) {
|
|
||||||
$arrayId[] = $address->getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $arrayId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description of CustomFieldChoiceWithOther
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class CustomFieldChoiceWithOther
|
|
||||||
{
|
|
||||||
//put your code here
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\CustomFields;
|
|
||||||
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Chill\CustomFieldsBundle\Entity\CustomField;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
interface CustomFieldInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param \Chill\CustomFieldsBundle\CustomField\FormBuilderInterface $builder
|
|
||||||
* @param \Chill\CustomFieldsBundle\CustomField\CustomField $customField
|
|
||||||
* @return \Symfony\Component\Form\FormTypeInterface the form type
|
|
||||||
*/
|
|
||||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* transform the value into a format that can be stored in DB
|
|
||||||
*
|
|
||||||
* @param mixed $value
|
|
||||||
* @param \Chill\CustomFieldsBundle\CustomField\CustomField $customField
|
|
||||||
*/
|
|
||||||
public function serialize($value, CustomField $customField);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transform the representation of the value, stored in db, into the
|
|
||||||
* value which may be used in the process.
|
|
||||||
*
|
|
||||||
* @param mixed $value
|
|
||||||
* @param \Chill\CustomFieldsBundle\CustomField\CustomField $customField
|
|
||||||
*/
|
|
||||||
public function deserialize($serialized, CustomField $customField);
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param type $value
|
|
||||||
* @param \Chill\CustomFieldsBundle\CustomField\CustomField $customField
|
|
||||||
*/
|
|
||||||
public function render($value, CustomField $customField);
|
|
||||||
|
|
||||||
public function getName();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return a formType which allow to edit option for the custom type.
|
|
||||||
* This FormType is shown in admin
|
|
||||||
*
|
|
||||||
* @param \Chill\CustomFieldsBundle\CustomField\FormBuilderInterface $builder
|
|
||||||
* @return \Symfony\Component\Form\FormTypeInterface|null the form type
|
|
||||||
*/
|
|
||||||
public function buildOptionsForm(FormBuilderInterface $builder);
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\CustomFields;
|
|
||||||
|
|
||||||
use Chill\CustomFieldsBundle\CustomFields\CustomFieldInterface;
|
|
||||||
use Chill\CustomFieldsBundle\Entity\CustomField;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class CustomFieldText implements CustomFieldInterface
|
|
||||||
{
|
|
||||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
|
|
||||||
{
|
|
||||||
$builder->add($customField->getSlug(), 'text', array(
|
|
||||||
'label' => $customField->getLabel()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function render($value, CustomField $customField)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function serialize($value, CustomField $customField)
|
|
||||||
{
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function deserialize($serialized, CustomField $customField)
|
|
||||||
{
|
|
||||||
return $serialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'text field';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildOptionsForm(FormBuilderInterface $builder)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\DependencyInjection;
|
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
||||||
use Symfony\Component\Config\FileLocator;
|
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
|
||||||
use Symfony\Component\DependencyInjection\Loader;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the class that loads and manages your bundle configuration
|
|
||||||
*
|
|
||||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
|
|
||||||
*/
|
|
||||||
class ChillCustomFieldsExtension extends Extension
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function load(array $configs, ContainerBuilder $container)
|
|
||||||
{
|
|
||||||
$configuration = new Configuration();
|
|
||||||
$config = $this->processConfiguration($configuration, $configs);
|
|
||||||
|
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
|
||||||
$loader->load('services.yml');
|
|
||||||
|
|
||||||
//add at least a blank array at 'customizable_entities' options
|
|
||||||
//$customizable_entities = (isset($config['customizables_entities'])
|
|
||||||
// && $config['customizables_entities'] !== FALSE)
|
|
||||||
// ? $config['customizables_entities'] : array();
|
|
||||||
|
|
||||||
$container->setParameter('chill_custom_fields.customizables_entities',
|
|
||||||
$config['customizables_entities']);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\DependencyInjection;
|
|
||||||
|
|
||||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
|
||||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the class that validates and merges configuration from your app/config files
|
|
||||||
*
|
|
||||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
|
|
||||||
*/
|
|
||||||
class Configuration implements ConfigurationInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function getConfigTreeBuilder()
|
|
||||||
{
|
|
||||||
$treeBuilder = new TreeBuilder();
|
|
||||||
$rootNode = $treeBuilder->root('chill_custom_fields');
|
|
||||||
|
|
||||||
$classInfo = "The class which may receive custom fields";
|
|
||||||
$nameInfo = "The name which will appears in the user interface. May be translatable";
|
|
||||||
$customizableEntitiesInfo = "A list of customizable entities";
|
|
||||||
|
|
||||||
$rootNode
|
|
||||||
->children()
|
|
||||||
->arrayNode('customizables_entities')
|
|
||||||
->info($customizableEntitiesInfo)
|
|
||||||
->defaultValue(array())
|
|
||||||
->prototype('array')
|
|
||||||
->children()
|
|
||||||
->scalarNode('class')->isRequired()->info($classInfo)->end()
|
|
||||||
->scalarNode('name') ->isRequired()->info($nameInfo) ->end()
|
|
||||||
->end()
|
|
||||||
->end()
|
|
||||||
->end()
|
|
||||||
;
|
|
||||||
|
|
||||||
return $treeBuilder;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\DependencyInjection;
|
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
||||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class CustomFieldCompilerPass implements CompilerPassInterface
|
|
||||||
{
|
|
||||||
public function process(ContainerBuilder $container)
|
|
||||||
{
|
|
||||||
if (!$container->hasDefinition('chill.custom_field_compiler')) {
|
|
||||||
throw new \LogicException('service chill.custom_field_compiler '
|
|
||||||
. 'is not defined.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$definition = $container->getDefinition(
|
|
||||||
'chill.custom_field_compiler'
|
|
||||||
);
|
|
||||||
|
|
||||||
$taggedServices = $container->findTaggedServiceIds(
|
|
||||||
'chill.custom_field'
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($taggedServices as $id => $tagAttributes) {
|
|
||||||
foreach ($tagAttributes as $attributes) {
|
|
||||||
$definition->addMethodCall(
|
|
||||||
'addCustomField',
|
|
||||||
array(new Reference($id), $attributes["type"])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Entity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adress
|
|
||||||
*/
|
|
||||||
class Adress
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var integer
|
|
||||||
*/
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $data;
|
|
||||||
|
|
||||||
|
|
||||||
public function __toString()
|
|
||||||
{
|
|
||||||
return $this->data . '(id:' .$this->id .')';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get id
|
|
||||||
*
|
|
||||||
* @return integer
|
|
||||||
*/
|
|
||||||
public function getId()
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set data
|
|
||||||
*
|
|
||||||
* @param string $data
|
|
||||||
*
|
|
||||||
* @return Adress
|
|
||||||
*/
|
|
||||||
public function setData($data)
|
|
||||||
{
|
|
||||||
$this->data = $data;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get data
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getData()
|
|
||||||
{
|
|
||||||
return $this->data;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,161 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Entity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BlopEntity
|
|
||||||
*/
|
|
||||||
class BlopEntity
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var integer
|
|
||||||
*/
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $field1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $field2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $customField = array();
|
|
||||||
|
|
||||||
private $adress;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get id
|
|
||||||
*
|
|
||||||
* @return integer
|
|
||||||
*/
|
|
||||||
public function getId()
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setAdress($a)
|
|
||||||
{
|
|
||||||
$this->adress = $a;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get field1
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getAdress()
|
|
||||||
{
|
|
||||||
return $this->adress;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set field1
|
|
||||||
*
|
|
||||||
* @param string $field1
|
|
||||||
*
|
|
||||||
* @return BlopEntity
|
|
||||||
*/
|
|
||||||
public function setField1($field1)
|
|
||||||
{
|
|
||||||
$this->field1 = $field1;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get field1
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getField1()
|
|
||||||
{
|
|
||||||
return $this->field1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set field2
|
|
||||||
*
|
|
||||||
* @param string $field2
|
|
||||||
*
|
|
||||||
* @return BlopEntity
|
|
||||||
*/
|
|
||||||
public function setField2($field2)
|
|
||||||
{
|
|
||||||
$this->field2 = $field2;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get field2
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getField2()
|
|
||||||
{
|
|
||||||
return $this->field2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set customField
|
|
||||||
*
|
|
||||||
* @param array $customField
|
|
||||||
*
|
|
||||||
* @return BlopEntity
|
|
||||||
*/
|
|
||||||
public function setCustomField(array $customField)
|
|
||||||
{
|
|
||||||
$this->customField = $customField;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get customField
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getCustomField()
|
|
||||||
{
|
|
||||||
|
|
||||||
return $this->customField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function cfGet($key)
|
|
||||||
{
|
|
||||||
echo "<br> -1- <br>";
|
|
||||||
echo gettype($this->customField);
|
|
||||||
echo "<br> -2- <br>";
|
|
||||||
echo $this->customField;
|
|
||||||
echo "<br> -3- <br>";
|
|
||||||
var_dump(json_decode($this->customField));
|
|
||||||
echo "<br> -4- <br>";
|
|
||||||
echo json_last_error_msg();
|
|
||||||
|
|
||||||
$customFieldArray = json_decode($this->customField, true);
|
|
||||||
|
|
||||||
if(array_key_exists($key, $customFieldArray)) {
|
|
||||||
return $customFieldArray[$key];
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function cfSet($key, $value)
|
|
||||||
{
|
|
||||||
echo "-";
|
|
||||||
$customFieldArray = json_decode($this->customField, true);
|
|
||||||
$customFieldArray[$key] = $value;
|
|
||||||
$this->setCustomField(json_encode($customFieldArray));
|
|
||||||
var_dump($customFieldArray);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,247 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Entity;
|
|
||||||
|
|
||||||
use Doctrine\ORM\EntityManager;
|
|
||||||
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
|
|
||||||
use Doctrine\ORM\Event\PreFlushEventArgs;
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
|
||||||
use Chill\CustomFieldsBundle\Entity\Adress;
|
|
||||||
|
|
||||||
|
|
||||||
// ATTENTION QD NOUVEL OBJ cree sans appel a doctrine
|
|
||||||
// on n'a pas la config de custom fields
|
|
||||||
// ET DONC ON NE SAIT PAS QUELS VARIABLES SONT VIA __GET
|
|
||||||
// ET __SET SONT DECRITES PAR CUSTOM FIELDS
|
|
||||||
|
|
||||||
// IDEE : Travailler avec Lifecycle
|
|
||||||
// set et get pour JSON Field
|
|
||||||
// - dans un tableau special
|
|
||||||
// postLoad (après que l'élément sort du EM) :
|
|
||||||
// - récupération des customs fields (ok!)
|
|
||||||
// - json -> obj dans des choses qui existent deja
|
|
||||||
// preFlush avant mise a jour de la db
|
|
||||||
// - met a jour les donnees liees au json et le json
|
|
||||||
// perPersist idem mais pour le persist
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BlopEntity2
|
|
||||||
*/
|
|
||||||
class BlopEntity2
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var integer
|
|
||||||
*/
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $customFieldData;
|
|
||||||
private $customFieldDataArray = array(); // customField apres json_decode
|
|
||||||
private $customFieldDataUnfolded = array(); // mise des entity de customFieldDataArray
|
|
||||||
|
|
||||||
private $customFieldConfigs = array();
|
|
||||||
|
|
||||||
private $customFieldConfigsLoaded = false;
|
|
||||||
|
|
||||||
// CHARGE DE LA DB LA CONFIG DES CUSTOM FIELDS
|
|
||||||
public function loadCustomFieldConfig(LifecycleEventArgs $args)
|
|
||||||
{
|
|
||||||
$em = $args->getObjectManager();
|
|
||||||
|
|
||||||
$customFields = $em
|
|
||||||
->getRepository('ChillCustomFieldsBundle:CustomField')
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
$customFieldsLablels = array_map(
|
|
||||||
function($e) { return $e->getLabel(); },
|
|
||||||
$customFields);
|
|
||||||
|
|
||||||
$this->customFieldConfigs = array_combine($customFieldsLablels, $customFields);
|
|
||||||
$this->customFieldConfigsLoaded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// A PARTIR DU JSON CREE LES OBJETS (MIS DANS customFieldDataUnfolded)
|
|
||||||
public function unfoldCustomFieldData(LifecycleEventArgs $args)
|
|
||||||
{
|
|
||||||
$em = $args->getObjectManager();
|
|
||||||
|
|
||||||
$customFieldDataArray = json_decode($this->customFieldData,true);
|
|
||||||
$customFieldDataUnfolded = array();
|
|
||||||
|
|
||||||
foreach ($this->customFieldConfigs as $key => $cfConfig) {
|
|
||||||
$type = $cfConfig->getType();
|
|
||||||
if(strpos($type,'ManyToMany') === 0) {
|
|
||||||
$fieldUnfolded = new ArrayCollection();
|
|
||||||
|
|
||||||
if(array_key_exists($key, $customFieldDataArray)) {
|
|
||||||
$entityClass = substr($type, 11, -1);
|
|
||||||
|
|
||||||
foreach ($customFieldDataArray[$key] as $idEntity) {
|
|
||||||
$fieldUnfolded->add($em
|
|
||||||
->getRepository('ChillCustomFieldsBundle:' . $entityClass)
|
|
||||||
->findOneById($idEntity));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$customFieldDataUnfolded[$key] = $fieldUnfolded;
|
|
||||||
} else if(strpos($type,'ManyToOne') === 0) {
|
|
||||||
$entityClass = 'Adress'; // substr($type,10,-1);
|
|
||||||
if(array_key_exists($key, $customFieldDataArray)) {
|
|
||||||
$customFieldDataUnfolded[$key] = $em
|
|
||||||
->getRepository('ChillCustomFieldsBundle:' . $entityClass)
|
|
||||||
->findOneById($customFieldDataArray[$key]);
|
|
||||||
} else {
|
|
||||||
// TODO : doit tjs avoir un id
|
|
||||||
$em
|
|
||||||
->getRepository('ChillCustomFieldsBundle:' . $entityClass)
|
|
||||||
->findOneById(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ($type === 'text') {
|
|
||||||
if(array_key_exists($key, $customFieldDataArray)) {
|
|
||||||
$customFieldDataUnfolded[$key] = $customFieldDataArray[$key];
|
|
||||||
} else {
|
|
||||||
$customFieldDataUnfolded[$key] = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->customFieldDataUnfolded = $customFieldDataUnfolded;
|
|
||||||
}
|
|
||||||
|
|
||||||
// AVANT PERSIST LES ELEMENTS QUI N'ONT PAS D'ID DOIVENT EN AVOIR UN (OM->PERSIST(OBJ))
|
|
||||||
// PUIS PASSAGE DES OBJETS (SE TROUVANT DANS customFieldDataUnfolded) VERS
|
|
||||||
// LE JSON (SE TROUVANT DANS customFieldData)
|
|
||||||
public function prePersist(LifecycleEventArgs $args)
|
|
||||||
{
|
|
||||||
$em = $args->getObjectManager();
|
|
||||||
|
|
||||||
$this->loadCustomFieldConfig($args);
|
|
||||||
|
|
||||||
foreach ($this->customFieldDataUnfolded as $key => $unfoldedData) {
|
|
||||||
$type = $this->customFieldConfigs[$key]->getType();
|
|
||||||
if(strpos($type,'ManyToMany') === 0) {
|
|
||||||
foreach ($this->customFieldDataUnfolded[$key] as $entity) {
|
|
||||||
if(! $entity->getId()) {
|
|
||||||
$em->persist($entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if(strpos($type,'ManyToOne') === 0) {
|
|
||||||
if(! $this->customFieldDataUnfolded[$key]->getId()) {
|
|
||||||
$em->persist($this->customFieldDataUnfolded[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->customFieldDataUnfoldedToCustomField();
|
|
||||||
}
|
|
||||||
|
|
||||||
// PUIS PASSAGE DES OBJETS (SE TROUVANT DANS customFieldDataUnfolded) VERS
|
|
||||||
// LE JSON (SE TROUVANT DANS customFieldData)
|
|
||||||
public function preFlush(PreFlushEventArgs $args)
|
|
||||||
{
|
|
||||||
$this->customFieldDataUnfoldedToCustomField();
|
|
||||||
}
|
|
||||||
|
|
||||||
// PUIS PASSAGE DES OBJETS (SE TROUVANT DANS customFieldDataUnfolded) VERS
|
|
||||||
// LE JSON (SE TROUVANT DANS customFieldData)
|
|
||||||
public function customFieldDataUnfoldedToCustomField()
|
|
||||||
{
|
|
||||||
// MISE A JOUR DE customFieldDataArray
|
|
||||||
foreach ($this->customFieldConfigs as $key => $cfConfig) {
|
|
||||||
$type = $cfConfig->getType();
|
|
||||||
if(strpos($type,'ManyToMany') === 0) {
|
|
||||||
$arrayMapRet = array();
|
|
||||||
foreach ($this->customFieldDataUnfolded[$key] as $entity) {
|
|
||||||
$arrayMapRet[] = $entity->getId();
|
|
||||||
}
|
|
||||||
$this->customFieldDataArray[$key] = $arrayMapRet; // array_map(function($e) { $e->getId(); }, $this->customFieldDataUnfolded[$key]);
|
|
||||||
} else if(strpos($type,'ManyToOne') === 0) {
|
|
||||||
if(array_key_exists($key, $this->customFieldDataUnfolded)) {
|
|
||||||
$this->customFieldDataArray[$key] = $this->customFieldDataUnfolded[$key]->getId();
|
|
||||||
} else {
|
|
||||||
// normalement $this->customFieldDataArray[$key] ne doit pas exister
|
|
||||||
if(array_key_exists($key, $this->customFieldDataArray)) {
|
|
||||||
throw new Exception("Error Processing Request", 1);
|
|
||||||
}
|
|
||||||
//retirer de $this->customFieldDataArray[$key]
|
|
||||||
}
|
|
||||||
} else if ($type === 'text') {
|
|
||||||
$this->customFieldDataArray[$key] = $this->customFieldDataUnfolded[$key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MISE A JOUR DE CustomFieldData
|
|
||||||
$this->setCustomFieldData(json_encode($this->customFieldDataArray));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __set($fieldName, $value) {
|
|
||||||
$setMethodName = 'set' . ucfirst($fieldName);
|
|
||||||
|
|
||||||
if(method_exists($this, $setMethodName)) {
|
|
||||||
return $this->{$setMethodName}($value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(array_key_exists($fieldName, $this->customFieldConfigs)) {
|
|
||||||
$this->customFieldDataUnfolded[$fieldName] = $value;
|
|
||||||
} else if (!$this->customFieldConfigsLoaded) { // nouvel object pas eu d'appel doctrine avant
|
|
||||||
$this->customFieldDataUnfolded[$fieldName] = $value;
|
|
||||||
} else {
|
|
||||||
throw new Exception("Error Processing Request", 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __get($fieldName) {
|
|
||||||
$getMethodName = 'get' . ucfirst($fieldName);
|
|
||||||
|
|
||||||
if(method_exists($this, $getMethodName)) {
|
|
||||||
return $this->{$getMethodName}();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(array_key_exists($fieldName, $this->customFieldDataUnfolded)) {
|
|
||||||
return $this->customFieldDataUnfolded[$fieldName];
|
|
||||||
} else if (!$this->customFieldConfigsLoaded) { // nouvel object pas eu d'appel doctrine avant
|
|
||||||
return null;
|
|
||||||
} else if(array_key_exists($fieldName, $this->customFieldConfigs)) { // pas init
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
throw new Exception("Error Processing Request", 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get id
|
|
||||||
*
|
|
||||||
* @return integer
|
|
||||||
*/
|
|
||||||
public function getId()
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set customField
|
|
||||||
*
|
|
||||||
* @param array $customField
|
|
||||||
*
|
|
||||||
* @return BlopEntity2
|
|
||||||
*/
|
|
||||||
public function setCustomFieldData($customFieldData)
|
|
||||||
{
|
|
||||||
$this->customFieldData = $customFieldData;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get customField
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getCustomFieldData()
|
|
||||||
{
|
|
||||||
return $this->customFieldData;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,280 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Entity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CustomField
|
|
||||||
*/
|
|
||||||
class CustomField
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var integer
|
|
||||||
*/
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $label;
|
|
||||||
|
|
||||||
private $slug;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var boolean
|
|
||||||
*/
|
|
||||||
private $active;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $options = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var float
|
|
||||||
*/
|
|
||||||
private $ordering;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
private $relation = 1;
|
|
||||||
|
|
||||||
const ONE_TO_ONE = 1;
|
|
||||||
const ONE_TO_MANY = 2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var CustomFieldsGroup
|
|
||||||
*/
|
|
||||||
private $customFieldGroup;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get id
|
|
||||||
*
|
|
||||||
* @return integer
|
|
||||||
*/
|
|
||||||
public function getId()
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSlug()
|
|
||||||
{
|
|
||||||
return $this->slug;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set label
|
|
||||||
*
|
|
||||||
* @param string $label
|
|
||||||
*
|
|
||||||
* @return CustomField
|
|
||||||
*/
|
|
||||||
public function setLabel($label)
|
|
||||||
{
|
|
||||||
$this->label = $label;
|
|
||||||
|
|
||||||
if ($this->slug === NULL) {
|
|
||||||
$this->slug = preg_replace('/[^A-Za-z0-9-]+/', '-', $label);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getOptions()
|
|
||||||
{
|
|
||||||
return $this->options;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get label
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getLabel()
|
|
||||||
{
|
|
||||||
return $this->label;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set type
|
|
||||||
*
|
|
||||||
* @param string $type
|
|
||||||
*
|
|
||||||
* @return CustomField
|
|
||||||
*/
|
|
||||||
public function setType($type)
|
|
||||||
{
|
|
||||||
$this->type = $type;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get type
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getType()
|
|
||||||
{
|
|
||||||
return $this->type;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRelation()
|
|
||||||
{
|
|
||||||
return $this->relation;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setRelation($relation)
|
|
||||||
{
|
|
||||||
$this->relation = $relation;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set active
|
|
||||||
*
|
|
||||||
* @param boolean $active
|
|
||||||
*
|
|
||||||
* @return CustomField
|
|
||||||
*/
|
|
||||||
public function setActive($active)
|
|
||||||
{
|
|
||||||
$this->active = $active;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get active
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public function getActive()
|
|
||||||
{
|
|
||||||
return $this->active;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get customFieldGroup
|
|
||||||
*
|
|
||||||
* @return CustomFieldsGroup
|
|
||||||
*/
|
|
||||||
public function getCustomFieldsGroup()
|
|
||||||
{
|
|
||||||
return $this->customFieldGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set customFieldGroup
|
|
||||||
*
|
|
||||||
* @param \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup
|
|
||||||
*
|
|
||||||
* @return CustomField
|
|
||||||
*/
|
|
||||||
public function setCustomFieldsGroup(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup = null)
|
|
||||||
{
|
|
||||||
$this->customFieldGroup = $customFieldGroup;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set name
|
|
||||||
*
|
|
||||||
* @param array $name
|
|
||||||
*
|
|
||||||
* @return CustomField
|
|
||||||
*/
|
|
||||||
public function setName($name)
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get name
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set order
|
|
||||||
*
|
|
||||||
* @param float $order
|
|
||||||
*
|
|
||||||
* @return CustomField
|
|
||||||
*/
|
|
||||||
public function setOrdering($order)
|
|
||||||
{
|
|
||||||
$this->ordering = $order;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get order
|
|
||||||
*
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getOrdering()
|
|
||||||
{
|
|
||||||
return $this->ordering;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set options
|
|
||||||
*
|
|
||||||
* @param array $options
|
|
||||||
*
|
|
||||||
* @return CustomField
|
|
||||||
*/
|
|
||||||
public function setOptions(array $options)
|
|
||||||
{
|
|
||||||
$this->options = $options;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set customFieldGroup
|
|
||||||
*
|
|
||||||
* @param \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup
|
|
||||||
*
|
|
||||||
* @return CustomField
|
|
||||||
*/
|
|
||||||
public function setCustomFieldGroup(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup = null)
|
|
||||||
{
|
|
||||||
$this->customFieldGroup = $customFieldGroup;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get customFieldGroup
|
|
||||||
*
|
|
||||||
* @return \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup
|
|
||||||
*/
|
|
||||||
public function getCustomFieldGroup()
|
|
||||||
{
|
|
||||||
return $this->customFieldGroup;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,146 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Entity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CustomFieldGroup
|
|
||||||
*/
|
|
||||||
class CustomFieldsGroup
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var integer
|
|
||||||
*/
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $entity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \Doctrine\Common\Collections\Collection
|
|
||||||
*/
|
|
||||||
private $customFields;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->customFields = new \Doctrine\Common\Collections\ArrayCollection();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add customField
|
|
||||||
*
|
|
||||||
* @param \Chill\CustomFieldsBundle\Entity\CustomField $customField
|
|
||||||
*
|
|
||||||
* @return CustomFieldsGroup
|
|
||||||
*/
|
|
||||||
public function addCustomField(\Chill\CustomFieldsBundle\Entity\CustomField $customField)
|
|
||||||
{
|
|
||||||
$this->customFields[] = $customField;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove customField
|
|
||||||
*
|
|
||||||
* @param \Chill\CustomFieldsBundle\Entity\CustomField $customField
|
|
||||||
*/
|
|
||||||
public function removeCustomField(\Chill\CustomFieldsBundle\Entity\CustomField $customField)
|
|
||||||
{
|
|
||||||
$this->customFields->removeElement($customField);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return \Doctrine\Common\Collections\Collection
|
|
||||||
*/
|
|
||||||
public function getCustomFields()
|
|
||||||
{
|
|
||||||
return $this->customFields;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get id
|
|
||||||
*
|
|
||||||
* @return integer
|
|
||||||
*/
|
|
||||||
public function getId()
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set name
|
|
||||||
*
|
|
||||||
* @param array $name
|
|
||||||
*
|
|
||||||
* @return CustomFieldsGroup
|
|
||||||
*/
|
|
||||||
public function setName($name)
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get name
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getName($language = null)
|
|
||||||
{
|
|
||||||
//TODO set this in a service, PLUS twig function
|
|
||||||
if ($language) {
|
|
||||||
if (isset($this->name[$language])) {
|
|
||||||
return $this->name[$language];
|
|
||||||
} else {
|
|
||||||
foreach ($this->name as $name) {
|
|
||||||
if (!empty($name)) {
|
|
||||||
return $name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set entity
|
|
||||||
*
|
|
||||||
* @param string $entity
|
|
||||||
*
|
|
||||||
* @return CustomFieldsGroup
|
|
||||||
*/
|
|
||||||
public function setEntity($entity)
|
|
||||||
{
|
|
||||||
$this->entity = $entity;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get entity
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getEntity()
|
|
||||||
{
|
|
||||||
return $this->entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Form;
|
|
||||||
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal Ne fonctionne pas encore
|
|
||||||
*/
|
|
||||||
class AdressType extends AbstractType
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FormBuilderInterface $builder
|
|
||||||
* @param array $options
|
|
||||||
*/
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
$builder
|
|
||||||
->add('data', 'entity', array(
|
|
||||||
|
|
||||||
))
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param OptionsResolverInterface $resolver
|
|
||||||
*/
|
|
||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
|
||||||
{
|
|
||||||
// $resolver->setDefaults(array(
|
|
||||||
// 'data_class' => 'Chill\CustomFieldsBundle\Entity\Adress',
|
|
||||||
// 'class' => 'Chill\CustomFieldsBundle\Entity\Adress'
|
|
||||||
// ));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getParent()
|
|
||||||
{
|
|
||||||
return 'entity';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'adress';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Form;
|
|
||||||
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
|
||||||
|
|
||||||
class BlopEntity2Type extends AbstractType
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param FormBuilderInterface $builder
|
|
||||||
* @param array $options
|
|
||||||
*/
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
$em = $options['em'];
|
|
||||||
|
|
||||||
$customFields = $em
|
|
||||||
->getRepository('ChillCustomFieldsBundle:CustomField')
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
foreach ($customFields as $cf) {
|
|
||||||
if($cf->getType() === 'ManyToOne(Adress)') {
|
|
||||||
$builder->add($cf->getLabel(), 'entity', array(
|
|
||||||
'class' => 'ChillCustomFieldsBundle:Adress',
|
|
||||||
'property' => 'data'
|
|
||||||
));
|
|
||||||
} else if ($cf->getType() === 'ManyToOnePersist(Adress)') {
|
|
||||||
$builder->add($cf->getLabel(), new AdressType());
|
|
||||||
} else if($cf->getType() === 'ManyToMany(Adress)') {
|
|
||||||
$builder->add($cf->getLabel(), 'entity', array(
|
|
||||||
'class' => 'ChillCustomFieldsBundle:Adress',
|
|
||||||
'property' => 'data',
|
|
||||||
'multiple' => true
|
|
||||||
));
|
|
||||||
} else if ($cf->getType() === 'text') {
|
|
||||||
$builder->add($cf->getLabel(), 'text');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param OptionsResolverInterface $resolver
|
|
||||||
*/
|
|
||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
|
||||||
{
|
|
||||||
$resolver->setDefaults(array(
|
|
||||||
'data_class' => 'Chill\CustomFieldsBundle\Entity\BlopEntity2'
|
|
||||||
));
|
|
||||||
|
|
||||||
// supprimer ça en definissant dans services
|
|
||||||
$resolver->setRequired(array(
|
|
||||||
'em',
|
|
||||||
));
|
|
||||||
|
|
||||||
$resolver->setAllowedTypes(array(
|
|
||||||
'em' => 'Doctrine\Common\Persistence\ObjectManager',
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'cl_customfieldsbundle_blopentity2';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Form;
|
|
||||||
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
|
||||||
use Chill\CustomFieldsBundle\Form\Type\CustomFieldType;
|
|
||||||
|
|
||||||
class BlopEntityType extends AbstractType
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param FormBuilderInterface $builder
|
|
||||||
* @param array $options
|
|
||||||
*/
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
$entityManager = $options['em'];
|
|
||||||
|
|
||||||
$builder
|
|
||||||
->add('field1')
|
|
||||||
->add('field2')
|
|
||||||
//->add('adress', new AdressType())
|
|
||||||
->add('customField', 'custom_field')
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param OptionsResolverInterface $resolver
|
|
||||||
*/
|
|
||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
|
||||||
{
|
|
||||||
$resolver->setDefaults(array(
|
|
||||||
'data_class' => 'Chill\CustomFieldsBundle\Entity\BlopEntity',
|
|
||||||
'cascade_validation' => true
|
|
||||||
));
|
|
||||||
|
|
||||||
// supprimer ça en definissant dans services
|
|
||||||
$resolver->setRequired(array(
|
|
||||||
'em',
|
|
||||||
));
|
|
||||||
|
|
||||||
$resolver->setAllowedTypes(array(
|
|
||||||
'em' => 'Doctrine\Common\Persistence\ObjectManager',
|
|
||||||
));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'cl_customfieldsbundle_blopentity';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Form;
|
|
||||||
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
|
||||||
use Chill\CustomFieldsBundle\Service\CustomFieldProvider;
|
|
||||||
use Chill\CustomFieldsBundle\Entity\CustomField;
|
|
||||||
|
|
||||||
class CustomFieldType extends AbstractType
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var CustomFieldProvider
|
|
||||||
*/
|
|
||||||
private $customFieldProvider;
|
|
||||||
|
|
||||||
private $culture = 'fr';
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct(CustomFieldProvider $compiler)
|
|
||||||
{
|
|
||||||
$this->customFieldProvider = $compiler;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param FormBuilderInterface $builder
|
|
||||||
* @param array $options
|
|
||||||
*/
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
|
|
||||||
$customFieldsList = array();
|
|
||||||
|
|
||||||
foreach ($this->customFieldProvider->getAllFields() as $key => $field) {
|
|
||||||
$customFieldsList[$key] = $field->getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
$builder
|
|
||||||
->add('name', 'text')
|
|
||||||
->add('active')
|
|
||||||
->add('customFieldsGroup', 'entity', array(
|
|
||||||
'class' => 'ChillCustomFieldsBundle:CustomFieldsGroup',
|
|
||||||
'property' => 'name['.$this->culture.']'
|
|
||||||
))
|
|
||||||
->add('ordering', 'number')
|
|
||||||
;
|
|
||||||
|
|
||||||
//add options field
|
|
||||||
$optionsType = $this->customFieldProvider
|
|
||||||
->getCustomFieldByType($options['type'])
|
|
||||||
->buildOptionsForm($builder);
|
|
||||||
if ($optionsType) {
|
|
||||||
$builder->add('options', $optionsType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param OptionsResolverInterface $resolver
|
|
||||||
*/
|
|
||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
|
||||||
{
|
|
||||||
$resolver->setDefaults(array(
|
|
||||||
'data_class' => 'Chill\CustomFieldsBundle\Entity\CustomField'
|
|
||||||
));
|
|
||||||
|
|
||||||
$resolver->setRequired(array('type'))
|
|
||||||
->addAllowedValues(array('type' =>
|
|
||||||
array_keys($this->customFieldProvider->getAllFields())
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'custom_field_choice';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Form;
|
|
||||||
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
|
||||||
use Symfony\Component\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
|
|
||||||
class CustomFieldsGroupType extends AbstractType
|
|
||||||
{
|
|
||||||
|
|
||||||
private $customizableEntities;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var \Symfony\Component\Translation\TranslatorInterface
|
|
||||||
*/
|
|
||||||
private $translator;
|
|
||||||
|
|
||||||
public function __construct(array $customizableEntities, TranslatorInterface $translator)
|
|
||||||
{
|
|
||||||
$this->customizableEntities = $customizableEntities;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param FormBuilderInterface $builder
|
|
||||||
* @param array $options
|
|
||||||
*/
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
//prepare translation
|
|
||||||
$customizableEntites = array();
|
|
||||||
|
|
||||||
foreach($this->customizableEntities as $key => $definition) {
|
|
||||||
$customizableEntites[$definition['class']] = $this->translator->trans($definition['name']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$builder
|
|
||||||
->add('name')
|
|
||||||
->add('entity', 'choice', array(
|
|
||||||
'choices' => $customizableEntites
|
|
||||||
))
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param OptionsResolverInterface $resolver
|
|
||||||
*/
|
|
||||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
|
||||||
{
|
|
||||||
$resolver->setDefaults(array(
|
|
||||||
'data_class' => 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup'
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'custom_fields_group';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Form\DataTransformer;
|
|
||||||
|
|
||||||
use Symfony\Component\Form\DataTransformerInterface;
|
|
||||||
use Chill\CustomFieldsBundle\CustomFields\CustomFieldInterface;
|
|
||||||
use Chill\CustomFieldsBundle\Entity\CustomField;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class CustomFieldDataTransformer implements DataTransformerInterface
|
|
||||||
{
|
|
||||||
private $customFieldDefinition;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var \Chill\CustomFieldsBundle\Entity\CustomField
|
|
||||||
*/
|
|
||||||
private $customField;
|
|
||||||
|
|
||||||
public function __construct(CustomFieldInterface $customFieldDefinition,
|
|
||||||
CustomField $customField)
|
|
||||||
{
|
|
||||||
$this->customFieldDefinition = $customFieldDefinition;
|
|
||||||
$this->customField = $customField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function reverseTransform($value)
|
|
||||||
{
|
|
||||||
return $this->customFieldDefinition->serialize($value,
|
|
||||||
$this->customField);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function transform($value)
|
|
||||||
{
|
|
||||||
return $this->customFieldDefinition->deserialize($value,
|
|
||||||
$this->customField);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,145 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Form\DataTransformer;
|
|
||||||
|
|
||||||
use Symfony\Component\Form\DataTransformerInterface;
|
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
|
||||||
|
|
||||||
class JsonCustomFieldToArrayTransformer implements DataTransformerInterface {
|
|
||||||
/**
|
|
||||||
* @var ObjectManager
|
|
||||||
*/
|
|
||||||
private $om;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ObjectManager $om
|
|
||||||
*/
|
|
||||||
public function __construct(ObjectManager $om)
|
|
||||||
{
|
|
||||||
$this->om = $om;
|
|
||||||
|
|
||||||
$customFields = $this->om
|
|
||||||
->getRepository('ChillCustomFieldsBundle:CustomField')
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
$customFieldsLablels = array_map(
|
|
||||||
function($e) { return $e->getLabel(); },
|
|
||||||
$customFields);
|
|
||||||
|
|
||||||
$customFieldsByLabel = array_combine($customFieldsLablels, $customFields);
|
|
||||||
|
|
||||||
$this->customField = $customFieldsByLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function transform($customFieldsJSON)
|
|
||||||
{
|
|
||||||
echo $customFieldsJSON;
|
|
||||||
|
|
||||||
if($customFieldsJSON === null) { // lors de la creation
|
|
||||||
$customFieldsArray = array();
|
|
||||||
} else {
|
|
||||||
$customFieldsArray = json_decode($customFieldsJSON,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
echo "<br> - 4 - <br>";
|
|
||||||
|
|
||||||
var_dump($customFieldsArray);
|
|
||||||
|
|
||||||
echo "<br> - 5 - <br>";
|
|
||||||
*/
|
|
||||||
|
|
||||||
$customFieldsArrayRet = array();
|
|
||||||
|
|
||||||
foreach ($customFieldsArray as $key => $value) {
|
|
||||||
$traited = false;
|
|
||||||
if(array_key_exists($key, $this->customField)) {
|
|
||||||
$type = $this->customField[$key]->getType();
|
|
||||||
if(strpos($type,'ManyToOne') === 0) {
|
|
||||||
if(strpos($type,'ManyToOnePersist') ===0) {
|
|
||||||
$entityClass = substr($type, 17, -1);
|
|
||||||
} else {
|
|
||||||
$entityClass = substr($type, 10, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
$customFieldsArrayRet[$key] = $this->om
|
|
||||||
->getRepository('ChillCustomFieldsBundle:' . $entityClass)
|
|
||||||
->findOneById($value);
|
|
||||||
$traited = true;
|
|
||||||
} else if ($type === 'ManyToMany(Adress)') {
|
|
||||||
$customFieldsArrayRet[$key] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(! $traited) {
|
|
||||||
$customFieldsArrayRet[$key] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var_dump($customFieldsArrayRet);
|
|
||||||
|
|
||||||
return $customFieldsArrayRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function reverseTransform($customFieldsArray)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
echo "<br> - - 7 - <br>";
|
|
||||||
|
|
||||||
|
|
||||||
var_dump(array_keys($customFieldsArray));
|
|
||||||
|
|
||||||
echo "<br> - - 8 - <br>";
|
|
||||||
|
|
||||||
var_dump(array_keys($this->customField));
|
|
||||||
|
|
||||||
echo "<br> - - 9 - <br>";
|
|
||||||
*/
|
|
||||||
|
|
||||||
//var_dump($customFieldsArray);
|
|
||||||
|
|
||||||
$customFieldsArrayRet = array();
|
|
||||||
|
|
||||||
foreach ($customFieldsArray as $key => $value) {
|
|
||||||
$traited = false;
|
|
||||||
if(array_key_exists($key, $this->customField)) {
|
|
||||||
$type = $this->customField[$key]->getType();
|
|
||||||
if(strpos($type,'ManyToOne') === 0) {
|
|
||||||
// pour le manytoone() faire
|
|
||||||
// un update du form en js ? : http://symfony.com/fr/doc/current/cookbook/form/form_collections.html
|
|
||||||
//
|
|
||||||
//$entityClass = substr($type, 10, -1);
|
|
||||||
//echo $entityClasss;
|
|
||||||
if(strpos($type, 'ManyToOnePersist') === 0) {
|
|
||||||
// PEUT ETRE A FAIRE SI SEULEMENT $value->getId() ne renvoie rien...
|
|
||||||
//
|
|
||||||
//
|
|
||||||
$this->om->persist($value); // pas bon ici
|
|
||||||
// LE PERSIST NE SERT QUE LA PREMIERE FOIS
|
|
||||||
// plutot le mettre dans une var temporaire de adress
|
|
||||||
// et faire le persist qd fait sur l'obj parent
|
|
||||||
// regarder : http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html
|
|
||||||
// ou : http://symfony.com/doc/current/cookbook/doctrine/event_listeners_subscribers.html
|
|
||||||
// dans yml :
|
|
||||||
// lifecycleCallbacks:
|
|
||||||
// prePersist: [ doStuffOnPrePersist, doOtherStuffOnPrePersist ]
|
|
||||||
$this->om->flush(); // sinon l'id pose pbm
|
|
||||||
}
|
|
||||||
|
|
||||||
$customFieldsArrayRet[$key] = $value->getId();
|
|
||||||
$traited = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(! $traited) {
|
|
||||||
$customFieldsArrayRet[$key] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//echo json_encode($customFieldsArrayRet);
|
|
||||||
|
|
||||||
return json_encode($customFieldsArrayRet);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,117 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the Symfony package.
|
|
||||||
*
|
|
||||||
* (c) Fabien Potencier <fabien@symfony.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Form\Type;
|
|
||||||
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Chill\CustomFieldsBundle\Form\DataTransformer\JsonCustomFieldToArrayTransformer;
|
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
|
||||||
use Chill\CustomFieldsBundle\Form\AdressType;
|
|
||||||
use Chill\CustomFieldsBundle\Service\CustomFieldProvider;
|
|
||||||
use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldDataTransformer;
|
|
||||||
|
|
||||||
class CustomFieldType extends AbstractType
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ObjectManager
|
|
||||||
*/
|
|
||||||
private $om;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var CustomFieldCompiler
|
|
||||||
*/
|
|
||||||
private $customFieldCompiler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ObjectManager $om
|
|
||||||
*/
|
|
||||||
public function __construct(ObjectManager $om, CustomFieldProvider $compiler)
|
|
||||||
{
|
|
||||||
$this->om = $om;
|
|
||||||
$this->customFieldCompiler = $compiler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
$customFields = $this->om
|
|
||||||
->getRepository('ChillCustomFieldsBundle:CustomField')
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
foreach ($customFields as $cf) {
|
|
||||||
|
|
||||||
//$builder->add(
|
|
||||||
//$builder->create(
|
|
||||||
//$cf->getSlug(),
|
|
||||||
$this->customFieldCompiler
|
|
||||||
->getCustomFieldByType($cf->getType())
|
|
||||||
->buildForm($builder, $cf);
|
|
||||||
/* )
|
|
||||||
->addModelTransformer(new CustomFieldDataTransformer(
|
|
||||||
$this->customFieldCompiler
|
|
||||||
->getCustomFieldByType($cf->getType()),
|
|
||||||
$cf)
|
|
||||||
)*/
|
|
||||||
//);
|
|
||||||
|
|
||||||
// if($cf->getType() === 'ManyToOne(Adress)') {
|
|
||||||
// $builder->add($cf->getLabel(), 'entity', array(
|
|
||||||
// 'class' => 'ChillCustomFieldsBundle:Adress',
|
|
||||||
// 'property' => 'data'
|
|
||||||
// ));
|
|
||||||
// } else if ($cf->getType() === 'ManyToOnePersist(Adress)') {
|
|
||||||
// $builder->add($cf->getLabel(), new AdressType());
|
|
||||||
// } else if($cf->getType() === 'ManyToMany(Adress)') {
|
|
||||||
//
|
|
||||||
// $adress = $this->om
|
|
||||||
// ->getRepository('ChillCustomFieldsBundle:Adress')
|
|
||||||
// ->findAll();
|
|
||||||
//
|
|
||||||
// $adressId = array_map(
|
|
||||||
// function($e) { return $e->getId(); },
|
|
||||||
// $adress);
|
|
||||||
//
|
|
||||||
// $adressLabel = array_map(
|
|
||||||
// function($e) { return (string) $e; },
|
|
||||||
// $adress);
|
|
||||||
//
|
|
||||||
// $addressChoices = array_combine($adressId, $adressLabel);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// $builder->add($cf->getLabel(), 'choice', array(
|
|
||||||
// 'choices' => $addressChoices,
|
|
||||||
// 'multiple' => true
|
|
||||||
// ));
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// $builder->add($cf->getLabel(), $cf->getType());
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
//$builder->addViewTransformer(new JsonCustomFieldToArrayTransformer($this->om));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setDefaultOptions(\Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver)
|
|
||||||
{
|
|
||||||
$resolver
|
|
||||||
//->addAllowedTypes(array('context' => 'string'))
|
|
||||||
//->setRequired(array('context'))
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'custom_field';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
Chill\CustomFieldsBundle\Entity\Adress:
|
|
||||||
type: entity
|
|
||||||
table: null
|
|
||||||
id:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
id: true
|
|
||||||
generator:
|
|
||||||
strategy: AUTO
|
|
||||||
fields:
|
|
||||||
data:
|
|
||||||
type: string
|
|
||||||
length: 255
|
|
||||||
lifecycleCallbacks: { }
|
|
@ -1,23 +0,0 @@
|
|||||||
Chill\CustomFieldsBundle\Entity\BlopEntity:
|
|
||||||
type: entity
|
|
||||||
table: blop_entity
|
|
||||||
id:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
id: true
|
|
||||||
generator:
|
|
||||||
strategy: AUTO
|
|
||||||
fields:
|
|
||||||
field1:
|
|
||||||
type: string
|
|
||||||
length: 255
|
|
||||||
field2:
|
|
||||||
type: string
|
|
||||||
length: 255
|
|
||||||
customField:
|
|
||||||
type: json_array
|
|
||||||
manyToOne:
|
|
||||||
adress:
|
|
||||||
targetEntity: Chill\CustomFieldsBundle\Entity\Adress
|
|
||||||
cascade: [persist]
|
|
||||||
lifecycleCallbacks: { }
|
|
@ -1,16 +0,0 @@
|
|||||||
Chill\CustomFieldsBundle\Entity\BlopEntity2:
|
|
||||||
type: entity
|
|
||||||
table: null
|
|
||||||
id:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
id: true
|
|
||||||
generator:
|
|
||||||
strategy: AUTO
|
|
||||||
fields:
|
|
||||||
customFieldData:
|
|
||||||
type: json_array
|
|
||||||
lifecycleCallbacks:
|
|
||||||
postLoad: [ loadCustomFieldConfig, unfoldCustomFieldData ]
|
|
||||||
preFlush: [ preFlush ]
|
|
||||||
prePersist: [ prePersist ]
|
|
@ -1,30 +0,0 @@
|
|||||||
Chill\CustomFieldsBundle\Entity\CustomField:
|
|
||||||
type: entity
|
|
||||||
table: null
|
|
||||||
id:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
id: true
|
|
||||||
generator:
|
|
||||||
strategy: AUTO
|
|
||||||
fields:
|
|
||||||
name:
|
|
||||||
type: json_array
|
|
||||||
slug:
|
|
||||||
type: string
|
|
||||||
length: 255
|
|
||||||
type:
|
|
||||||
type: string
|
|
||||||
length: 255
|
|
||||||
active:
|
|
||||||
type: boolean
|
|
||||||
ordering:
|
|
||||||
type: float
|
|
||||||
options:
|
|
||||||
type: json_array
|
|
||||||
lifecycleCallbacks: { }
|
|
||||||
manyToOne:
|
|
||||||
customFieldGroup:
|
|
||||||
targetEntity: Chill\CustomFieldsBundle\Entity\CustomFieldsGroup
|
|
||||||
inversedBy: customFields
|
|
||||||
#TODO: add an unique constraint slug+customFieldsGroup
|
|
@ -1,19 +0,0 @@
|
|||||||
Chill\CustomFieldsBundle\Entity\CustomFieldsGroup:
|
|
||||||
type: entity
|
|
||||||
table: null
|
|
||||||
id:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
id: true
|
|
||||||
generator:
|
|
||||||
strategy: AUTO
|
|
||||||
fields:
|
|
||||||
name:
|
|
||||||
type: json_array
|
|
||||||
entity:
|
|
||||||
type: string
|
|
||||||
length: 255
|
|
||||||
oneToMany:
|
|
||||||
customFields:
|
|
||||||
targetEntity: Chill\CustomFieldsBundle\Entity\CustomField
|
|
||||||
mappedBy: customFieldGroup
|
|
@ -1,20 +0,0 @@
|
|||||||
cl_custom_fields_customfieldsgroup:
|
|
||||||
resource: "@ChillCustomFieldsBundle/Resources/config/routing/customfieldsgroup.yml"
|
|
||||||
prefix: /customfieldsgroup
|
|
||||||
|
|
||||||
cl_custom_fields_blopentity2:
|
|
||||||
resource: "@ChillCustomFieldsBundle/Resources/config/routing/blopentity2.yml"
|
|
||||||
prefix: /blopentity2
|
|
||||||
|
|
||||||
cl_custom_fields_adress:
|
|
||||||
resource: "@ChillCustomFieldsBundle/Resources/config/routing/adress.yml"
|
|
||||||
prefix: /adress
|
|
||||||
|
|
||||||
cl_custom_fields_customfield:
|
|
||||||
resource: "@ChillCustomFieldsBundle/Resources/config/routing/customfield.yml"
|
|
||||||
prefix: /customfield
|
|
||||||
|
|
||||||
cl_custom_fields_blopentity:
|
|
||||||
resource: "@ChillCustomFieldsBundle/Resources/config/routing/blopentity.yml"
|
|
||||||
prefix: /
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
|||||||
adress:
|
|
||||||
path: /
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:Adress:index" }
|
|
||||||
|
|
||||||
adress_show:
|
|
||||||
path: /{id}/show
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:Adress:show" }
|
|
||||||
|
|
||||||
adress_new:
|
|
||||||
path: /new
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:Adress:new" }
|
|
||||||
|
|
||||||
adress_create:
|
|
||||||
path: /create
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:Adress:create" }
|
|
||||||
requirements: { _method: post }
|
|
||||||
|
|
||||||
adress_edit:
|
|
||||||
path: /{id}/edit
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:Adress:edit" }
|
|
||||||
|
|
||||||
adress_update:
|
|
||||||
path: /{id}/update
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:Adress:update" }
|
|
||||||
requirements: { _method: post|put }
|
|
||||||
|
|
||||||
adress_delete:
|
|
||||||
path: /{id}/delete
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:Adress:delete" }
|
|
||||||
requirements: { _method: post|delete }
|
|
@ -1,42 +0,0 @@
|
|||||||
blopentity:
|
|
||||||
path: /
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:index" }
|
|
||||||
|
|
||||||
blopentity_show:
|
|
||||||
path: /{id}/show
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:show" }
|
|
||||||
|
|
||||||
blopentity_new:
|
|
||||||
path: /new
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:new" }
|
|
||||||
|
|
||||||
blopentity_create:
|
|
||||||
path: /create
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:create" }
|
|
||||||
requirements: { _method: post }
|
|
||||||
|
|
||||||
blopentity_edit:
|
|
||||||
path: /{id}/edit
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:edit" }
|
|
||||||
|
|
||||||
blopentity_update:
|
|
||||||
path: /{id}/update
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:update" }
|
|
||||||
requirements: { _method: post|put }
|
|
||||||
|
|
||||||
blopentity_delete:
|
|
||||||
path: /{id}/delete
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:delete" }
|
|
||||||
requirements: { _method: post|delete }
|
|
||||||
|
|
||||||
blopentity_cfget:
|
|
||||||
path: /{id}/cfget/{key}
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:cfGet" }
|
|
||||||
|
|
||||||
blopentity_cfset:
|
|
||||||
path: /{id}/cfset/{key}/{value}
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:cfSet" }
|
|
||||||
|
|
||||||
blopentity_addmany_to_one:
|
|
||||||
path: /{id}/add/custom/field/{key}
|
|
||||||
defaults: {_controller: "ChillCustomFieldsBundle:BlopEntity:addNewManyToOne"}
|
|
@ -1,30 +0,0 @@
|
|||||||
blopentity2:
|
|
||||||
path: /
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:index" }
|
|
||||||
|
|
||||||
blopentity2_show:
|
|
||||||
path: /{id}/show
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:show" }
|
|
||||||
|
|
||||||
blopentity2_new:
|
|
||||||
path: /new
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:new" }
|
|
||||||
|
|
||||||
blopentity2_create:
|
|
||||||
path: /create
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:create" }
|
|
||||||
requirements: { _method: post }
|
|
||||||
|
|
||||||
blopentity2_edit:
|
|
||||||
path: /{id}/edit
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:edit" }
|
|
||||||
|
|
||||||
blopentity2_update:
|
|
||||||
path: /{id}/update
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:update" }
|
|
||||||
requirements: { _method: post|put }
|
|
||||||
|
|
||||||
blopentity2_delete:
|
|
||||||
path: /{id}/delete
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:delete" }
|
|
||||||
requirements: { _method: post|delete }
|
|
@ -1,30 +0,0 @@
|
|||||||
customfield:
|
|
||||||
path: /
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomField:index" }
|
|
||||||
|
|
||||||
customfield_show:
|
|
||||||
path: /{id}/show
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomField:show" }
|
|
||||||
|
|
||||||
customfield_new:
|
|
||||||
path: /new
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomField:new" }
|
|
||||||
|
|
||||||
customfield_create:
|
|
||||||
path: /create
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomField:create" }
|
|
||||||
requirements: { _method: post }
|
|
||||||
|
|
||||||
customfield_edit:
|
|
||||||
path: /{id}/edit
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomField:edit" }
|
|
||||||
|
|
||||||
customfield_update:
|
|
||||||
path: /{id}/update
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomField:update" }
|
|
||||||
requirements: { _method: post|put }
|
|
||||||
|
|
||||||
customfield_delete:
|
|
||||||
path: /{id}/delete
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomField:delete" }
|
|
||||||
requirements: { _method: post|delete }
|
|
@ -1,30 +0,0 @@
|
|||||||
customfieldsgroup:
|
|
||||||
path: /
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:index" }
|
|
||||||
|
|
||||||
customfieldsgroup_show:
|
|
||||||
path: /{id}/show
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:show" }
|
|
||||||
|
|
||||||
customfieldsgroup_new:
|
|
||||||
path: /new
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:new" }
|
|
||||||
|
|
||||||
customfieldsgroup_create:
|
|
||||||
path: /create
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:create" }
|
|
||||||
requirements: { _method: post }
|
|
||||||
|
|
||||||
customfieldsgroup_edit:
|
|
||||||
path: /{id}/edit
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:edit" }
|
|
||||||
|
|
||||||
customfieldsgroup_update:
|
|
||||||
path: /{id}/update
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:update" }
|
|
||||||
requirements: { _method: post|put }
|
|
||||||
|
|
||||||
customfieldsgroup_delete:
|
|
||||||
path: /{id}/delete
|
|
||||||
defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:delete" }
|
|
||||||
requirements: { _method: post|delete }
|
|
@ -1,44 +0,0 @@
|
|||||||
parameters:
|
|
||||||
# cl_custom_fields.example.class: Chill\CustomFieldsBundle\Example
|
|
||||||
|
|
||||||
services:
|
|
||||||
chill.custom_field_compiler:
|
|
||||||
class: Chill\CustomFieldsBundle\Service\CustomFieldProvider
|
|
||||||
call:
|
|
||||||
- [setContainer, ["@service_container"]]
|
|
||||||
|
|
||||||
chill.custom_field.custom_field_choice_type:
|
|
||||||
class: Chill\CustomFieldsBundle\Form\CustomFieldType
|
|
||||||
arguments:
|
|
||||||
- "@chill.custom_field_compiler"
|
|
||||||
|
|
||||||
tags:
|
|
||||||
- { name: 'form.type', alias: 'custom_field_choice' }
|
|
||||||
|
|
||||||
chill.custom_field.custom_fields_group_type:
|
|
||||||
class: Chill\CustomFieldsBundle\Form\CustomFieldsGroupType
|
|
||||||
arguments:
|
|
||||||
- %chill_custom_fields.customizables_entities%
|
|
||||||
- "@translator"
|
|
||||||
tags:
|
|
||||||
- { name: 'form.type', alias: 'custom_fields_group' }
|
|
||||||
|
|
||||||
chill.custom_field.custom_field_type:
|
|
||||||
class: Chill\CustomFieldsBundle\Form\Type\CustomFieldType
|
|
||||||
arguments:
|
|
||||||
- "@doctrine.orm.entity_manager"
|
|
||||||
- "@chill.custom_field_compiler"
|
|
||||||
tags:
|
|
||||||
- { name: 'form.type', alias: 'custom_field' }
|
|
||||||
|
|
||||||
chill.custom_field.text:
|
|
||||||
class: Chill\CustomFieldsBundle\CustomFields\CustomFieldText
|
|
||||||
tags:
|
|
||||||
- { name: 'chill.custom_field', type: 'text' }
|
|
||||||
|
|
||||||
chill.custom_field.address:
|
|
||||||
class: Chill\CustomFieldsBundle\CustomFields\CustomFieldAddress
|
|
||||||
arguments:
|
|
||||||
- "@doctrine.orm.entity_manager"
|
|
||||||
tags:
|
|
||||||
- { name: 'chill.custom_field', type: 'address' }
|
|
@ -1,16 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>Adress edit</h1>
|
|
||||||
|
|
||||||
{{ form(edit_form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('adress') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,41 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>Adress list</h1>
|
|
||||||
|
|
||||||
<table class="records_list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<th>Data</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for entity in entities %}
|
|
||||||
<tr>
|
|
||||||
<td><a href="{{ path('adress_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
|
|
||||||
<td>{{ entity.data }}</td>
|
|
||||||
<td>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('adress_show', { 'id': entity.id }) }}">show</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('adress_edit', { 'id': entity.id }) }}">edit</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('adress_new') }}">
|
|
||||||
Create a new entry
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>Adress creation</h1>
|
|
||||||
|
|
||||||
{{ form(form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('adress') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,32 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>Adress</h1>
|
|
||||||
|
|
||||||
<table class="record_properties">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<td>{{ entity.id }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Data</th>
|
|
||||||
<td>{{ entity.data }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('adress') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('adress_edit', { 'id': entity.id }) }}">
|
|
||||||
Edit
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,22 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>BlopEntity edit</h1>
|
|
||||||
|
|
||||||
{{ form_start(edit_form) }}
|
|
||||||
|
|
||||||
{{ form_row(edit_form.customField) }}
|
|
||||||
|
|
||||||
{{ form_rest(edit_form) }}
|
|
||||||
|
|
||||||
{{ form_end(edit_form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,45 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>BlopEntity list</h1>
|
|
||||||
|
|
||||||
<table class="records_list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<th>Field1</th>
|
|
||||||
<th>Field2</th>
|
|
||||||
<th>Customfield</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for entity in entities %}
|
|
||||||
<tr>
|
|
||||||
<td><a href="{{ path('blopentity_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
|
|
||||||
<td>{{ entity.field1 }}</td>
|
|
||||||
<td>{{ entity.field2 }}</td>
|
|
||||||
<td>{{ dump(entity.customField) }}</td>
|
|
||||||
<td>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity_show', { 'id': entity.id }) }}">show</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity_edit', { 'id': entity.id }) }}">edit</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity_new') }}">
|
|
||||||
Create a new entry
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>BlopEntity creation</h1>
|
|
||||||
|
|
||||||
{{ form(form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,40 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>BlopEntity</h1>
|
|
||||||
|
|
||||||
<table class="record_properties">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<td>{{ entity.id }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Field1</th>
|
|
||||||
<td>{{ entity.field1 }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Field2</th>
|
|
||||||
<td>{{ entity.field2 }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Customfield</th>
|
|
||||||
<td>{{ dump(entity.customField) }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity_edit', { 'id': entity.id }) }}">
|
|
||||||
Edit
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,16 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>BlopEntity2 edit</h1>
|
|
||||||
|
|
||||||
{{ form(edit_form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity2') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,41 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>BlopEntity2 list</h1>
|
|
||||||
|
|
||||||
<table class="records_list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<th>CustomfieldData</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for entity in entities %}
|
|
||||||
<tr>
|
|
||||||
<td><a href="{{ path('blopentity2_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
|
|
||||||
<td>{{ entity.CustomfieldData }}</td>
|
|
||||||
<td>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity2_show', { 'id': entity.id }) }}">show</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity2_edit', { 'id': entity.id }) }}">edit</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity2_new') }}">
|
|
||||||
Create a new entry
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>BlopEntity2 creation</h1>
|
|
||||||
|
|
||||||
{{ form(form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity2') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,32 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>BlopEntity2</h1>
|
|
||||||
|
|
||||||
<table class="record_properties">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<td>{{ entity.id }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>CustomfieldData</th>
|
|
||||||
<td>{{ entity.customFieldData }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity2') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('blopentity2_edit', { 'id': entity.id }) }}">
|
|
||||||
Edit
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,16 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>CustomField edit</h1>
|
|
||||||
|
|
||||||
{{ form(edit_form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('customfield') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,5 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
{{ form(form) }}
|
|
||||||
{% endblock %}
|
|
@ -1,50 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>CustomField list</h1>
|
|
||||||
|
|
||||||
<table class="records_list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<th>Label</th>
|
|
||||||
<th>Type</th>
|
|
||||||
<th>Active</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for entity in entities %}
|
|
||||||
<tr>
|
|
||||||
<td><a href="{{ path('customfield_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
|
|
||||||
<td>{{ entity.label }}</td>
|
|
||||||
<td>{{ entity.type }}</td>
|
|
||||||
<td>{{ entity.active }}</td>
|
|
||||||
<td>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('customfield_show', { 'id': entity.id }) }}">show</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('customfield_edit', { 'id': entity.id }) }}">edit</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
{{ form_start(form) }}
|
|
||||||
|
|
||||||
{{ form_row(form) }}
|
|
||||||
<button type="submit">
|
|
||||||
Create a new entry
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{{ form_end(form) }}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>CustomField creation</h1>
|
|
||||||
|
|
||||||
{{ form(form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('customfield') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,40 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>CustomField</h1>
|
|
||||||
|
|
||||||
<table class="record_properties">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<td>{{ entity.id }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Label</th>
|
|
||||||
<td>{{ entity.label }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Type</th>
|
|
||||||
<td>{{ entity.type }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Active</th>
|
|
||||||
<td>{{ entity.active }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('customfield') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('customfield_edit', { 'id': entity.id }) }}">
|
|
||||||
Edit
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,16 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>CustomFieldsGroup edit</h1>
|
|
||||||
|
|
||||||
{{ form(edit_form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('customfieldsgroup') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,43 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>CustomFieldsGroup list</h1>
|
|
||||||
|
|
||||||
<table class="records_list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Entity</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for entity in entities %}
|
|
||||||
<tr>
|
|
||||||
<td><a href="{{ path('customfieldsgroup_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
|
|
||||||
<td>{{ entity.name['fr'] }}</td>
|
|
||||||
<td>{{ entity.entity }}</td>
|
|
||||||
<td>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('customfieldsgroup_show', { 'id': entity.id }) }}">show</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('customfieldsgroup_edit', { 'id': entity.id }) }}">edit</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('customfieldsgroup_new') }}">
|
|
||||||
Create a new entry
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>CustomFieldsGroup creation</h1>
|
|
||||||
|
|
||||||
{{ form(form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('customfieldsgroup') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,36 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>CustomFieldsGroup</h1>
|
|
||||||
|
|
||||||
<table class="record_properties">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<td>{{ entity.id }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<td>{{ entity.name }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Entity</th>
|
|
||||||
<td>{{ entity.entity }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('customfieldsgroup') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('customfieldsgroup_edit', { 'id': entity.id }) }}">
|
|
||||||
Edit
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1 +0,0 @@
|
|||||||
Hello {{ name }}!
|
|
@ -1,16 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>Entity edit</h1>
|
|
||||||
|
|
||||||
{{ form(edit_form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('entity') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,45 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>Entity list</h1>
|
|
||||||
|
|
||||||
<table class="records_list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<th>Field1</th>
|
|
||||||
<th>Field2</th>
|
|
||||||
<th>Customfields</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for entity in entities %}
|
|
||||||
<tr>
|
|
||||||
<td><a href="{{ path('entity_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
|
|
||||||
<td>{{ entity.field1 }}</td>
|
|
||||||
<td>{{ entity.field2 }}</td>
|
|
||||||
<td>{{ entity.customFields }}</td>
|
|
||||||
<td>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('entity_show', { 'id': entity.id }) }}">show</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('entity_edit', { 'id': entity.id }) }}">edit</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('entity_new') }}">
|
|
||||||
Create a new entry
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>Entity creation</h1>
|
|
||||||
|
|
||||||
{{ form(form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('entity') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,40 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>Entity</h1>
|
|
||||||
|
|
||||||
<table class="record_properties">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<td>{{ entity.id }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Field1</th>
|
|
||||||
<td>{{ entity.field1 }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Field2</th>
|
|
||||||
<td>{{ entity.field2 }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Customfields</th>
|
|
||||||
<td>{{ entity.customFields }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('entity') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('entity_edit', { 'id': entity.id }) }}">
|
|
||||||
Edit
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,16 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>TestEntity edit</h1>
|
|
||||||
|
|
||||||
{{ form(edit_form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testentity') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,45 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>TestEntity list</h1>
|
|
||||||
|
|
||||||
<table class="records_list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<th>Field1</th>
|
|
||||||
<th>Field2</th>
|
|
||||||
<th>Customfields</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for entity in entities %}
|
|
||||||
<tr>
|
|
||||||
<td><a href="{{ path('testentity_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
|
|
||||||
<td>{{ entity.field1 }}</td>
|
|
||||||
<td>{{ entity.field2 }}</td>
|
|
||||||
<td>{{ entity.customFields }}</td>
|
|
||||||
<td>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testentity_show', { 'id': entity.id }) }}">show</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testentity_edit', { 'id': entity.id }) }}">edit</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testentity_new') }}">
|
|
||||||
Create a new entry
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>TestEntity creation</h1>
|
|
||||||
|
|
||||||
{{ form(form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testentity') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,40 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>TestEntity</h1>
|
|
||||||
|
|
||||||
<table class="record_properties">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<td>{{ entity.id }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Field1</th>
|
|
||||||
<td>{{ entity.field1 }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Field2</th>
|
|
||||||
<td>{{ entity.field2 }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Customfields</th>
|
|
||||||
<td>{{ entity.customFields }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testentity') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testentity_edit', { 'id': entity.id }) }}">
|
|
||||||
Edit
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,16 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>TestExtraColumn edit</h1>
|
|
||||||
|
|
||||||
{{ form(edit_form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testextracolumn') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,41 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>TestExtraColumn list</h1>
|
|
||||||
|
|
||||||
<table class="records_list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for entity in entities %}
|
|
||||||
<tr>
|
|
||||||
<td><a href="{{ path('testextracolumn_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
|
|
||||||
<td>{{ entity.name }}</td>
|
|
||||||
<td>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testextracolumn_show', { 'id': entity.id }) }}">show</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testextracolumn_edit', { 'id': entity.id }) }}">edit</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testextracolumn_new') }}">
|
|
||||||
Create a new entry
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>TestExtraColumn creation</h1>
|
|
||||||
|
|
||||||
{{ form(form) }}
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testextracolumn') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,32 +0,0 @@
|
|||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body -%}
|
|
||||||
<h1>TestExtraColumn</h1>
|
|
||||||
|
|
||||||
<table class="record_properties">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<td>{{ entity.id }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<td>{{ entity.name }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testextracolumn') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('testextracolumn_edit', { 'id': entity.id }) }}">
|
|
||||||
Edit
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -1,58 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Service;
|
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Receive all service tagged with 'chill.custom_field'
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class CustomFieldProvider implements ContainerAwareInterface
|
|
||||||
{
|
|
||||||
private $servicesByType = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface
|
|
||||||
*/
|
|
||||||
private $container;
|
|
||||||
|
|
||||||
public function addCustomField($serviceName, $type)
|
|
||||||
{
|
|
||||||
$this->servicesByType[$type] = $serviceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param string $type
|
|
||||||
* @return CustomFieldInterface
|
|
||||||
*/
|
|
||||||
public function getCustomFieldByType($type)
|
|
||||||
{
|
|
||||||
if (isset($this->servicesByType[$type])) {
|
|
||||||
return $this->servicesByType[$type];
|
|
||||||
} else {
|
|
||||||
throw new \LogicException('the custom field with type '.$type.' '
|
|
||||||
. 'is not found');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setContainer(ContainerInterface $container = null)
|
|
||||||
{
|
|
||||||
if ($container === null) {
|
|
||||||
throw new \LogicException('container should not be null');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->container = $container;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAllFields()
|
|
||||||
{
|
|
||||||
return $this->servicesByType;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Tests\Config;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test the option Customizables_entities
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class ConfigCustomizablesEntitiesTest extends KernelTestCase
|
|
||||||
{
|
|
||||||
public function testEmptyConfig()
|
|
||||||
{
|
|
||||||
self::bootKernel(array('environment' => 'test'));
|
|
||||||
$customizableEntities = static::$kernel->getContainer()
|
|
||||||
->getParameter('chill_custom_fields.customizables_entities');
|
|
||||||
|
|
||||||
$this->assertInternalType('array', $customizableEntities);
|
|
||||||
$this->assertCount(0, $customizableEntities);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Tests\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
||||||
|
|
||||||
class AdressControllerTest extends WebTestCase
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
public function testCompleteScenario()
|
|
||||||
{
|
|
||||||
// Create a new client to browse the application
|
|
||||||
$client = static::createClient();
|
|
||||||
|
|
||||||
// Create a new entry in the database
|
|
||||||
$crawler = $client->request('GET', '/adress/');
|
|
||||||
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /adress/");
|
|
||||||
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
|
|
||||||
|
|
||||||
// Fill in the form and submit it
|
|
||||||
$form = $crawler->selectButton('Create')->form(array(
|
|
||||||
'cl_customfieldsbundle_adress[field_name]' => 'Test',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check data in the show view
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
|
|
||||||
|
|
||||||
// Edit the entity
|
|
||||||
$crawler = $client->click($crawler->selectLink('Edit')->link());
|
|
||||||
|
|
||||||
$form = $crawler->selectButton('Update')->form(array(
|
|
||||||
'cl_customfieldsbundle_adress[field_name]' => 'Foo',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the element contains an attribute with value equals "Foo"
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
|
|
||||||
|
|
||||||
// Delete the entity
|
|
||||||
$client->submit($crawler->selectButton('Delete')->form());
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the entity has been delete on the list
|
|
||||||
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Tests\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
||||||
|
|
||||||
class BlopEntity2ControllerTest extends WebTestCase
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
public function testCompleteScenario()
|
|
||||||
{
|
|
||||||
// Create a new client to browse the application
|
|
||||||
$client = static::createClient();
|
|
||||||
|
|
||||||
// Create a new entry in the database
|
|
||||||
$crawler = $client->request('GET', '/blopentity2/');
|
|
||||||
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /blopentity2/");
|
|
||||||
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
|
|
||||||
|
|
||||||
// Fill in the form and submit it
|
|
||||||
$form = $crawler->selectButton('Create')->form(array(
|
|
||||||
'cl_customfieldsbundle_blopentity2[field_name]' => 'Test',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check data in the show view
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
|
|
||||||
|
|
||||||
// Edit the entity
|
|
||||||
$crawler = $client->click($crawler->selectLink('Edit')->link());
|
|
||||||
|
|
||||||
$form = $crawler->selectButton('Update')->form(array(
|
|
||||||
'cl_customfieldsbundle_blopentity2[field_name]' => 'Foo',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the element contains an attribute with value equals "Foo"
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
|
|
||||||
|
|
||||||
// Delete the entity
|
|
||||||
$client->submit($crawler->selectButton('Delete')->form());
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the entity has been delete on the list
|
|
||||||
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Tests\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
||||||
|
|
||||||
class BlopEntityControllerTest extends WebTestCase
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
public function testCompleteScenario()
|
|
||||||
{
|
|
||||||
// Create a new client to browse the application
|
|
||||||
$client = static::createClient();
|
|
||||||
|
|
||||||
// Create a new entry in the database
|
|
||||||
$crawler = $client->request('GET', '/blopentity/');
|
|
||||||
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /blopentity/");
|
|
||||||
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
|
|
||||||
|
|
||||||
// Fill in the form and submit it
|
|
||||||
$form = $crawler->selectButton('Create')->form(array(
|
|
||||||
'cl_customfieldsbundle_blopentity[field_name]' => 'Test',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check data in the show view
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
|
|
||||||
|
|
||||||
// Edit the entity
|
|
||||||
$crawler = $client->click($crawler->selectLink('Edit')->link());
|
|
||||||
|
|
||||||
$form = $crawler->selectButton('Update')->form(array(
|
|
||||||
'cl_customfieldsbundle_blopentity[field_name]' => 'Foo',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the element contains an attribute with value equals "Foo"
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
|
|
||||||
|
|
||||||
// Delete the entity
|
|
||||||
$client->submit($crawler->selectButton('Delete')->form());
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the entity has been delete on the list
|
|
||||||
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Tests\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
||||||
|
|
||||||
class CustomFieldControllerTest extends WebTestCase
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
public function testCompleteScenario()
|
|
||||||
{
|
|
||||||
// Create a new client to browse the application
|
|
||||||
$client = static::createClient();
|
|
||||||
|
|
||||||
// Create a new entry in the database
|
|
||||||
$crawler = $client->request('GET', '/customfield/');
|
|
||||||
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /customfield/");
|
|
||||||
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
|
|
||||||
|
|
||||||
// Fill in the form and submit it
|
|
||||||
$form = $crawler->selectButton('Create')->form(array(
|
|
||||||
'cl_customfieldsbundle_customfield[field_name]' => 'Test',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check data in the show view
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
|
|
||||||
|
|
||||||
// Edit the entity
|
|
||||||
$crawler = $client->click($crawler->selectLink('Edit')->link());
|
|
||||||
|
|
||||||
$form = $crawler->selectButton('Update')->form(array(
|
|
||||||
'cl_customfieldsbundle_customfield[field_name]' => 'Foo',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the element contains an attribute with value equals "Foo"
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
|
|
||||||
|
|
||||||
// Delete the entity
|
|
||||||
$client->submit($crawler->selectButton('Delete')->form());
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the entity has been delete on the list
|
|
||||||
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Tests\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
||||||
|
|
||||||
class CustomFieldsGroupControllerTest extends WebTestCase
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
public function testCompleteScenario()
|
|
||||||
{
|
|
||||||
// Create a new client to browse the application
|
|
||||||
$client = static::createClient();
|
|
||||||
|
|
||||||
// Create a new entry in the database
|
|
||||||
$crawler = $client->request('GET', '/customfieldsgroup/');
|
|
||||||
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /customfieldsgroup/");
|
|
||||||
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
|
|
||||||
|
|
||||||
// Fill in the form and submit it
|
|
||||||
$form = $crawler->selectButton('Create')->form(array(
|
|
||||||
'cl_customfieldsbundle_customfieldsgroup[field_name]' => 'Test',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check data in the show view
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
|
|
||||||
|
|
||||||
// Edit the entity
|
|
||||||
$crawler = $client->click($crawler->selectLink('Edit')->link());
|
|
||||||
|
|
||||||
$form = $crawler->selectButton('Update')->form(array(
|
|
||||||
'cl_customfieldsbundle_customfieldsgroup[field_name]' => 'Foo',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the element contains an attribute with value equals "Foo"
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
|
|
||||||
|
|
||||||
// Delete the entity
|
|
||||||
$client->submit($crawler->selectButton('Delete')->form());
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the entity has been delete on the list
|
|
||||||
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Tests\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
||||||
|
|
||||||
class EntityControllerTest extends WebTestCase
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
public function testCompleteScenario()
|
|
||||||
{
|
|
||||||
// Create a new client to browse the application
|
|
||||||
$client = static::createClient();
|
|
||||||
|
|
||||||
// Create a new entry in the database
|
|
||||||
$crawler = $client->request('GET', '/entity/');
|
|
||||||
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /entity/");
|
|
||||||
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
|
|
||||||
|
|
||||||
// Fill in the form and submit it
|
|
||||||
$form = $crawler->selectButton('Create')->form(array(
|
|
||||||
'cl_customfieldsbundle_entity[field_name]' => 'Test',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check data in the show view
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
|
|
||||||
|
|
||||||
// Edit the entity
|
|
||||||
$crawler = $client->click($crawler->selectLink('Edit')->link());
|
|
||||||
|
|
||||||
$form = $crawler->selectButton('Update')->form(array(
|
|
||||||
'cl_customfieldsbundle_entity[field_name]' => 'Foo',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the element contains an attribute with value equals "Foo"
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
|
|
||||||
|
|
||||||
// Delete the entity
|
|
||||||
$client->submit($crawler->selectButton('Delete')->form());
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the entity has been delete on the list
|
|
||||||
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Tests\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
||||||
|
|
||||||
class TestEntityControllerTest extends WebTestCase
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
public function testCompleteScenario()
|
|
||||||
{
|
|
||||||
// Create a new client to browse the application
|
|
||||||
$client = static::createClient();
|
|
||||||
|
|
||||||
// Create a new entry in the database
|
|
||||||
$crawler = $client->request('GET', '/testentity/');
|
|
||||||
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /testentity/");
|
|
||||||
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
|
|
||||||
|
|
||||||
// Fill in the form and submit it
|
|
||||||
$form = $crawler->selectButton('Create')->form(array(
|
|
||||||
'cl_customfieldsbundle_testentity[field_name]' => 'Test',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check data in the show view
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
|
|
||||||
|
|
||||||
// Edit the entity
|
|
||||||
$crawler = $client->click($crawler->selectLink('Edit')->link());
|
|
||||||
|
|
||||||
$form = $crawler->selectButton('Update')->form(array(
|
|
||||||
'cl_customfieldsbundle_testentity[field_name]' => 'Foo',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the element contains an attribute with value equals "Foo"
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
|
|
||||||
|
|
||||||
// Delete the entity
|
|
||||||
$client->submit($crawler->selectButton('Delete')->form());
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the entity has been delete on the list
|
|
||||||
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\CustomFieldsBundle\Tests\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
||||||
|
|
||||||
class TestExtraColumnControllerTest extends WebTestCase
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
public function testCompleteScenario()
|
|
||||||
{
|
|
||||||
// Create a new client to browse the application
|
|
||||||
$client = static::createClient();
|
|
||||||
|
|
||||||
// Create a new entry in the database
|
|
||||||
$crawler = $client->request('GET', '/testextracolumn/');
|
|
||||||
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /testextracolumn/");
|
|
||||||
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
|
|
||||||
|
|
||||||
// Fill in the form and submit it
|
|
||||||
$form = $crawler->selectButton('Create')->form(array(
|
|
||||||
'cl_customfieldsbundle_testextracolumn[field_name]' => 'Test',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check data in the show view
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
|
|
||||||
|
|
||||||
// Edit the entity
|
|
||||||
$crawler = $client->click($crawler->selectLink('Edit')->link());
|
|
||||||
|
|
||||||
$form = $crawler->selectButton('Update')->form(array(
|
|
||||||
'cl_customfieldsbundle_testextracolumn[field_name]' => 'Foo',
|
|
||||||
// ... other fields to fill
|
|
||||||
));
|
|
||||||
|
|
||||||
$client->submit($form);
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the element contains an attribute with value equals "Foo"
|
|
||||||
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
|
|
||||||
|
|
||||||
// Delete the entity
|
|
||||||
$client->submit($crawler->selectButton('Delete')->form());
|
|
||||||
$crawler = $client->followRedirect();
|
|
||||||
|
|
||||||
// Check the entity has been delete on the list
|
|
||||||
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Kernel;
|
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
|
||||||
|
|
||||||
class AppKernel extends Kernel
|
|
||||||
{
|
|
||||||
public function registerBundles()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
|
||||||
new Chill\CustomFieldsBundle\ChillCustomFieldsBundle(),
|
|
||||||
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
|
||||||
new Symfony\Bundle\TwigBundle\TwigBundle(),
|
|
||||||
new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
|
|
||||||
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle()
|
|
||||||
#add here all the required bundle (some bundle are not required)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function registerContainerConfiguration(LoaderInterface $loader)
|
|
||||||
{
|
|
||||||
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCacheDir()
|
|
||||||
{
|
|
||||||
return sys_get_temp_dir().'/CustomFieldsBundle/cache';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getLogDir()
|
|
||||||
{
|
|
||||||
return sys_get_temp_dir().'/CustomFieldsBundle/logs';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
imports:
|
|
||||||
- { resource: parameters.yml }
|
|
||||||
|
|
||||||
framework:
|
|
||||||
secret: Not very secret
|
|
||||||
router: { resource: "%kernel.root_dir%/config/routing.yml" }
|
|
||||||
form: true
|
|
||||||
csrf_protection: true
|
|
||||||
session: ~
|
|
||||||
default_locale: fr
|
|
||||||
translator: { fallback: fr }
|
|
||||||
profiler: { only_exceptions: false }
|
|
||||||
templating:
|
|
||||||
engines: ['twig']
|
|
||||||
|
|
||||||
doctrine:
|
|
||||||
dbal:
|
|
||||||
driver: pdo_pgsql
|
|
||||||
host: "%database_host%"
|
|
||||||
port: "%database_port%"
|
|
||||||
dbname: "%database_name%"
|
|
||||||
user: "%database_user%"
|
|
||||||
password: "%database_password%"
|
|
||||||
charset: UTF8
|
|
||||||
orm:
|
|
||||||
auto_generate_proxy_classes: "%kernel.debug%"
|
|
||||||
auto_mapping: true
|
|
@ -1,7 +0,0 @@
|
|||||||
imports:
|
|
||||||
- { resource: config.yml } #here we import a config.yml file, this is not required
|
|
||||||
|
|
||||||
framework:
|
|
||||||
test: ~
|
|
||||||
session:
|
|
||||||
storage_id: session.storage.filesystem
|
|
@ -1,8 +0,0 @@
|
|||||||
# config/config_test.yml
|
|
||||||
imports:
|
|
||||||
- { resource: config.yml } #here we import a config.yml file, this is not required
|
|
||||||
|
|
||||||
framework:
|
|
||||||
test: ~
|
|
||||||
session:
|
|
||||||
storage_id: session.storage.filesystem
|
|
@ -1,6 +0,0 @@
|
|||||||
parameters:
|
|
||||||
database_host: 127.0.0.1
|
|
||||||
database_port: 5434
|
|
||||||
database_name: symfony
|
|
||||||
database_user: symfony
|
|
||||||
database_password: symfony
|
|
@ -1,4 +0,0 @@
|
|||||||
cl_custom_fields:
|
|
||||||
resource: "@ChillCustomFieldsBundle/Resources/config/routing.yml"
|
|
||||||
prefix: /
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
|||||||
#!/usr/bin/env php
|
|
||||||
<?php
|
|
||||||
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
|
|
||||||
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
|
|
||||||
//umask(0000);
|
|
||||||
set_time_limit(0);
|
|
||||||
require_once __DIR__.'/../../../bootstrap.php';
|
|
||||||
require_once __DIR__.'/AppKernel.php';
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
|
||||||
use Symfony\Component\Console\Input\ArgvInput;
|
|
||||||
use Symfony\Component\Debug\Debug;
|
|
||||||
$input = new ArgvInput();
|
|
||||||
$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
|
|
||||||
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
|
|
||||||
if ($debug) {
|
|
||||||
Debug::enable();
|
|
||||||
}
|
|
||||||
$kernel = new AppKernel($env, $debug);
|
|
||||||
$application = new Application($kernel);
|
|
||||||
$application->run($input);
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\Debug\Debug;
|
|
||||||
|
|
||||||
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
|
|
||||||
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
|
|
||||||
//umask(0000);
|
|
||||||
|
|
||||||
// This check prevents access to debug front controllers that are deployed by accident to production servers.
|
|
||||||
// Feel free to remove this, extend it, or make something more sophisticated.
|
|
||||||
if (isset($_SERVER['HTTP_CLIENT_IP'])
|
|
||||||
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
|
||||||
|| !(in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server')
|
|
||||||
) {
|
|
||||||
header('HTTP/1.0 403 Forbidden');
|
|
||||||
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
|
|
||||||
Debug::enable();
|
|
||||||
|
|
||||||
require_once __DIR__.'/../app/AppKernel.php';
|
|
||||||
|
|
||||||
$kernel = new AppKernel('dev', true);
|
|
||||||
$kernel->loadClassCache();
|
|
||||||
$request = Request::createFromGlobals();
|
|
||||||
$response = $kernel->handle($request);
|
|
||||||
$response->send();
|
|
||||||
$kernel->terminate($request, $response);
|
|
@ -1,8 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if (!is_file($autoloadFile = __DIR__.'/../vendor/autoload.php')) {
|
|
||||||
throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?');
|
|
||||||
}
|
|
||||||
|
|
||||||
require $autoloadFile;
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "chill-project/custom-fields",
|
|
||||||
"license": "AGPL-3.0",
|
|
||||||
"type": "symfony-bundle",
|
|
||||||
"description": "This bundle allow to add custom fields on entities.",
|
|
||||||
"keywords" : ["chill", "social work"],
|
|
||||||
"homepage" : "https://github.com/Chill-project/custom-fields",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": { "Chill\\CustomFieldsBundle\\": "" }
|
|
||||||
},
|
|
||||||
"authors" : [
|
|
||||||
{
|
|
||||||
"name": "Champs-Libres",
|
|
||||||
"email": "info@champs-libres.coop",
|
|
||||||
"homepage": "http://www.champs-libres.coop"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"require": {
|
|
||||||
"php": "~5.5",
|
|
||||||
"symfony/symfony": "2.5.*",
|
|
||||||
"doctrine/orm": "~2.5@dev",
|
|
||||||
"doctrine/dbal" : "~2.5@dev",
|
|
||||||
"doctrine/doctrine-bundle": "~1.2@dev",
|
|
||||||
"twig/extensions": "~1.0",
|
|
||||||
"symfony/assetic-bundle": "~2.3",
|
|
||||||
"symfony/swiftmailer-bundle": "~2.3",
|
|
||||||
"symfony/monolog-bundle": "~2.4",
|
|
||||||
"sensio/distribution-bundle": "~3.0",
|
|
||||||
"sensio/framework-extra-bundle": "~3.0"
|
|
||||||
}
|
|
||||||
}
|
|
1626
src/Chill/CustomFieldsBundle/composer.lock
generated
1626
src/Chill/CustomFieldsBundle/composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
|||||||
php Tests/Fixtures/App/app/console.php $1 $2 $3 $4 $5
|
|
@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<phpunit bootstrap="./Tests/bootstrap.php" colors="true">
|
|
||||||
<!-- the file "./Tests/boostrap.php" will be created on the next step -->
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="ChillMain test suite">
|
|
||||||
<directory suffix="Test.php">./Tests</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
<filter>
|
|
||||||
<whitelist>
|
|
||||||
<directory>./</directory>
|
|
||||||
<exclude>
|
|
||||||
<directory>./Resources</directory>
|
|
||||||
<directory>./Tests</directory>
|
|
||||||
<directory>./vendor</directory>
|
|
||||||
</exclude>
|
|
||||||
</whitelist>
|
|
||||||
</filter>
|
|
||||||
<php>
|
|
||||||
<server name="KERNEL_DIR" value="/Tests/Fixtures/App/app/" />
|
|
||||||
</php>
|
|
||||||
</phpunit>
|
|
@ -1 +0,0 @@
|
|||||||
php Tests/Fixtures/App/app/console.php server:run --docroot=Tests/Fixtures/App/web/
|
|
Loading…
x
Reference in New Issue
Block a user