示例#1
0
 /**
  * Set ticket
  *
  * @param \Hackzilla\Bundle\TicketBundle\Entity\Ticket $ticket
  *
  * @return $this
  */
 public function setTicket(Ticket $ticket = null)
 {
     $this->ticket = $ticket;
     if (\is_null($this->getUserObject())) {
         $user = $this->getUser();
     } else {
         $user = $this->getUserObject();
     }
     // if null, then new ticket
     if (\is_null($ticket->getUserCreated())) {
         $ticket->setUserCreated($user);
     }
     $ticket->setLastUser($user);
     $ticket->setLastMessage($this->getCreatedAt());
     $ticket->setPriority($this->getPriority());
     // if ticket not closed, then it'll be set to null
     if (\is_null($this->getStatus())) {
         $this->setStatus($ticket->getStatus());
     } else {
         $ticket->setStatus($this->getStatus());
     }
     return $this;
 }