Skip to content

Commit

Permalink
after merge ticket2
Browse files Browse the repository at this point in the history
  • Loading branch information
gliderShip committed Jun 4, 2012
2 parents 08e6ec6 + 33e2876 commit 5f94594
Show file tree
Hide file tree
Showing 14 changed files with 594 additions and 119 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
.idea
vendor/
9 changes: 9 additions & 0 deletions .travis.yml
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
3 changes: 1 addition & 2 deletions Admin/TicketAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public function configureShowFields(ShowMapper $showMapper)
{
$showMapper
->add('id')
->add('createdAt')
->add('createdBy')
->add('category')
->add('subject')
Expand Down Expand Up @@ -44,7 +43,7 @@ public function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('id')
->add('createdAt')
->add('rate')
->add('category')
->add('subject')
->add('language')
Expand Down
85 changes: 85 additions & 0 deletions Controller/CommentController.php.orig
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()
));
}

}
Loading

0 comments on commit 5f94594

Please sign in to comment.