示例#1
0
 public function testPrePersist()
 {
     $this->assertNull($this->comment->getCreatedAt());
     $this->comment->prePersist();
     $this->assertInstanceOf('DateTime', $this->comment->getCreatedAt());
     $this->assertLessThan(3, $this->comment->getCreatedAt()->diff(new \DateTime())->s);
 }
示例#2
0
 /**
  * @param CaseComment $comment
  * @return array
  */
 public function createCommentView(CaseComment $comment)
 {
     $result = ['id' => $comment->getId(), 'message' => nl2br(htmlspecialchars($comment->getMessage())), 'briefMessage' => htmlspecialchars(mb_substr(preg_replace('/[\\n\\r]+/', ' ', $comment->getMessage()), 0, 200)), 'public' => $comment->isPublic(), 'createdAt' => $comment->getCreatedAt() ? $this->dateTimeFormatter->format($comment->getCreatedAt()) : null, 'updatedAt' => $comment->getUpdatedAt() ? $this->dateTimeFormatter->format($comment->getUpdatedAt()) : null, 'permissions' => array('edit' => $this->securityFacade->isGranted('EDIT', $comment), 'delete' => $this->securityFacade->isGranted('DELETE', $comment))];
     if ($comment->getContact()) {
         $result['createdBy'] = $this->createAuthorView($comment->getContact());
     } elseif ($comment->getOwner()) {
         $result['createdBy'] = $this->createAuthorView($comment->getOwner());
     }
     if ($comment->getUpdatedBy()) {
         $result['updatedBy'] = $this->createAuthorView($comment->getUpdatedBy());
     }
     return $result;
 }
示例#3
0
 /**
  * @param CaseComment $comment
  */
 public function soapInit($comment)
 {
     $this->id = $comment->getId();
     $this->message = $comment->getMessage();
     $this->public = $comment->isPublic();
     $this->case = $this->getEntityId($comment->getCase());
     $this->contact = $this->getEntityId($comment->getContact());
     $this->updatedBy = $this->getEntityId($comment->getUpdatedBy());
     $this->owner = $this->getEntityId($comment->getOwner());
     $this->createdAt = $comment->getCreatedAt();
     $this->updatedAt = $comment->getUpdatedAt();
 }