Example #1
0
 /**
  * @test
  */
 public function setCommentdateForDateTimeSetsCommentdate()
 {
     $dateTimeFixture = new \DateTime();
     $this->subject->setCommentdate($dateTimeFixture);
     $this->assertAttributeEquals($dateTimeFixture, 'commentdate', $this->subject);
 }
Example #2
0
 /**
  * ajax action - deletes a post in the repository
  *
  * @param \Lobacher\Simpleblog\Domain\Model\Post $post
  * @param \Lobacher\Simpleblog\Domain\Model\
  * @return bool|string
  */
 public function ajaxAction(Post $post, Comment $comment = NULL)
 {
     if ($comment->getComment() == '') {
         return FALSE;
     }
     $comment->setCommentdate(new \DateTime());
     $post->addComment($comment);
     $this->postRepository->update($post);
     $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager')->persistAll();
     $comments = $post->getComments();
     foreach ($comments as $comment) {
         $json[$comment->getUid()] = array('comment' => $comment->getComment(), 'commentdate' => $comment->getCommentdate());
     }
     return json_encode($json);
 }