Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @Route("/profile/posts", name="admin_posts")
- */
- public function postsAction()
- {
- $postRepo = $this->getDoctrine()->getRepository(Posts::class);
- $posts = $postRepo->findAll([],['limit' => 10]);
- $form = $this->createFormBuilder((new Posts),['method' => 'post','action' => '/profile/posts/save'])
- ->add('title',TextType::class,
- ['attr' => [
- 'class' => 'form-control'
- ]]
- )
- ->add('text',TextareaType::class,
- ['attr' => [
- 'class' => 'form-control'
- ]]
- )
- ->add('attach',FileType::class,
- ['attr' => [
- 'class' => 'form-control'
- ]]
- )
- ->add('save',SubmitType::class,
- ['attr' => [
- 'class' => 'btn btn-xs btn-success'
- ]]
- )
- ->getForm();
- return $this->render('AppBundle:Profile:posts.html.twig',
- [
- 'form' => $form->createView(),
- 'posts' => $posts
- ]
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement