mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Integration code generated
This commit is contained in:
parent
86b24f58ac
commit
faffdee1ab
@ -68,7 +68,9 @@ class ActivityController extends Controller
|
|||||||
$em->persist($entity);
|
$em->persist($entity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('chill_activity_activity_show', array('id' => $entity->getId())));
|
return $this->redirect(
|
||||||
|
$this->generateUrl('chill_activity_activity_show',
|
||||||
|
array('id' => $entity->getId(), 'person_id' => $person_id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:new.html.twig', array(
|
return $this->render('ChillActivityBundle:Activity:new.html.twig', array(
|
||||||
@ -107,6 +109,9 @@ class ActivityController extends Controller
|
|||||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||||
|
|
||||||
$entity = new Activity();
|
$entity = new Activity();
|
||||||
|
$entity->setUser($this->get('security.context')->getToken()->getUser());
|
||||||
|
$entity->setDate(new \DateTime('now'));
|
||||||
|
|
||||||
$form = $this->createCreateForm($entity, $person);
|
$form = $this->createCreateForm($entity, $person);
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:new.html.twig', array(
|
return $this->render('ChillActivityBundle:Activity:new.html.twig', array(
|
||||||
@ -120,9 +125,10 @@ class ActivityController extends Controller
|
|||||||
* Finds and displays a Activity entity.
|
* Finds and displays a Activity entity.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function showAction($id)
|
public function showAction($person_id, $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
||||||
|
|
||||||
@ -130,7 +136,7 @@ class ActivityController extends Controller
|
|||||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
$deleteForm = $this->createDeleteForm($id, $person);
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:show.html.twig', array(
|
return $this->render('ChillActivityBundle:Activity:show.html.twig', array(
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
@ -243,10 +249,12 @@ class ActivityController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Symfony\Component\Form\Form The form
|
* @return \Symfony\Component\Form\Form The form
|
||||||
*/
|
*/
|
||||||
private function createDeleteForm($id)
|
private function createDeleteForm($id, $person)
|
||||||
{
|
{
|
||||||
return $this->createFormBuilder()
|
return $this->createFormBuilder()
|
||||||
->setAction($this->generateUrl('chill_activity_activity_delete', array('id' => $id)))
|
->setAction($this->generateUrl(
|
||||||
|
'chill_activity_activity_delete',
|
||||||
|
array('id' => $id, 'person_id' => $person->getId())))
|
||||||
->setMethod('DELETE')
|
->setMethod('DELETE')
|
||||||
->add('submit', 'submit', array('label' => 'Delete'))
|
->add('submit', 'submit', array('label' => 'Delete'))
|
||||||
->getForm()
|
->getForm()
|
||||||
|
@ -99,7 +99,7 @@ class Activity
|
|||||||
*
|
*
|
||||||
* @return Activity
|
* @return Activity
|
||||||
*/
|
*/
|
||||||
public function setUserr(User $user)
|
public function setUser(User $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@ class ActivityType extends AbstractType
|
|||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('date')
|
->add('date', 'date', array('widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
|
||||||
->add('durationTime')
|
->add('durationTime')
|
||||||
->add('remark')
|
->add('remark')
|
||||||
->add('attendee')
|
->add('attendee', 'checkbox', array('required' => false))
|
||||||
->add('user')
|
->add('user')
|
||||||
//->add('scope')
|
//->add('scope')
|
||||||
//->add('reason')
|
//->add('reason')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user