示例#1
0
 /**
  * Displays a form to create a new Post entity.
  *
  * @Template()
  */
 public function newAction()
 {
     $entity = new Post();
     $entity->setStatus(1);
     $form = $this->createForm(new PostType(), $entity);
     return ['entity' => $entity, 'form' => $form->createView()];
 }
 private function handleMarkdown(Post $entity)
 {
     $entity->setContentCutedHtml($this->getMarkdown()->transformMarkdown(explode('[cut]', $entity->getContentMd())[0]));
     $entity->setContentHtml($this->getMarkdown()->transformMarkdown(str_replace('[cut]', '', $entity->getContentMd())));
 }