Exemple #1
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();
 }
Exemple #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;
 }
Exemple #3
0
 public function testPublic()
 {
     $this->assertFalse($this->comment->isPublic());
     $this->assertEquals($this->comment, $this->comment->setPublic(true));
     $this->assertTrue($this->comment->isPublic());
 }