forked from liuggio/HelpDeskBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
594 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.idea | ||
.idea | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
language: php | ||
php: | ||
- 5.3 | ||
- 5.4 | ||
env: | ||
- SYMFONY_VERSION=v2.0.10 | ||
- SYMFONY_VERSION=origin/2.0 | ||
- SYMFONY_VERSION=origin/master | ||
before_script: php vendor/vendors.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
namespace Liuggio\HelpDeskTicketSystemBundle\Controller; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
|
||
use Liuggio\HelpDeskTicketSystemBundle\Entity\Comment; | ||
use Liuggio\HelpDeskTicketSystemBundle\Form\CommentType; | ||
|
||
/** | ||
* Comment controller. | ||
* | ||
*/ | ||
class CommentController extends Controller | ||
{ | ||
<<<<<<< HEAD | ||
======= | ||
|
||
|
||
|
||
/** | ||
* Displays a form to create a new Comment entity. | ||
* | ||
*/ | ||
public function newAction() | ||
{ | ||
$entity = new Comment(); | ||
|
||
$form = $this->createForm(new CommentType(), $entity); | ||
|
||
return $this->render('LiuggioHelpDeskTicketSystemBundle:Comment:new.html.twig', array( | ||
'entity' => $entity, | ||
'form' => $form->createView() | ||
)); | ||
} | ||
|
||
>>>>>>> 33e2876859150022f4cae24d33d9672e550f3b79 | ||
/** | ||
* Creates a new Comment entity. | ||
* | ||
*/ | ||
public function createAction() | ||
{ | ||
//Retrive the User from the Session | ||
$user = $this->get('security.context')->getToken()->getUser(); | ||
|
||
$entity = new Comment(); | ||
$request = $this->getRequest(); | ||
$form = $this->createForm(new CommentType(), $entity); | ||
$form->bindRequest($request); | ||
|
||
if ($form->isValid()) { | ||
$em = $this->getDoctrine()->getEntityManager(); | ||
$comment = $form->getData(); | ||
$form = $this->getRequest()->get('liuggio_helpdeskticketsystembundle_commenttype'); | ||
$ticket_id = $form['ticket']; | ||
$ticket = $em->getRepository('LiuggioHelpDeskTicketSystemBundle:Ticket')->find($ticket_id); | ||
if (!$ticket) { | ||
throw $this->createNotFoundException('Unable to find Ticket entity.'); | ||
} | ||
|
||
$state_pending = $em->getRepository('\Liuggio\HelpDeskTicketSystemBundle\Entity\TicketState') | ||
->findOneByCode(\Liuggio\HelpDeskTicketSystemBundle\Entity\TicketState::STATE_PENDING); | ||
|
||
if ($state_pending) { | ||
$ticket->setState($state_pending); | ||
} | ||
//Set the createdBy user | ||
$entity->setCreatedBy($user); | ||
$em->persist($ticket); | ||
$comment->setTicket($ticket); | ||
$em->persist($comment); | ||
$em->flush(); | ||
|
||
return $this->redirect($this->generateUrl('ticket_show', array('id' => $ticket_id))); | ||
|
||
} | ||
|
||
return $this->render('LiuggioHelpDeskTicketSystemBundle:Comment:new.html.twig', array( | ||
'entity' => $entity, | ||
'form' => $form->createView() | ||
)); | ||
} | ||
|
||
} |
Oops, something went wrong.