Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace AppBundle\Controller;
- use AppBundle\Entity\Oferty;
- use AppBundle\Entity\Preferencje_Oferty;
- use AppBundle\Entity\Preferencje;
- use AppBundle\Entity\Wyposazenie_Oferty;
- use AppBundle\Entity\Wyposazenie_Oferty_Oferty;
- use AppBundle\Entity\Wyposazenie;
- use AppBundle\Form\NoweOgloszenie;
- use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
- use Symfony\Bundle\FrameworkBundle\Controller\Controller;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\Validator\Tests\Fixtures\Entity;
- use Symfony\Component\HttpFoundation\Response;
- use Symfony\Component\Validator\Mapping\ClassMetadata;
- use Symfony\Component\Validator\Constraints;
- use Symfony\Component\Validator\Constraints\NotBlank;
- use Symfony\Component\Validator\Constraints\Email;
- use Symfony\Component\Validator\Constraints\MinLength;
- use Symfony\Component\Validator\Constraints\MaxLength;
- class NoweOgloszenieController extends Controller
- {
- /**
- * @Route("/NoweOgloszenie", name="NoweOgloszenie")
- */
- public function newAction(Request $request)
- {
- $task = new Oferty();
- $form = $this->createForm(new NoweOgloszenie());
- $form->handleRequest($request);
- if ($form->isValid()) {
- $validator = $this->get('validator');
- $errors = $validator->validate($Oferta);
- if (count($errors) > 0) {
- return new Response(print_r($errors, true));
- } else {
- return $this->redirectToRoute('_oferta',array('idOferty' => $Oferta->getIdOferty()));
- }
- }
- return $this->render(':Szablony:noweogloszenie.html.twig', array(
- 'form' => $form->createView(),
- ));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment