


1.kawałek kontrolera
$NrKlientaForm = $this->createForm(new NrKlientaType());
2. class NrKlientaTyp
class NrKlientaType extends AbstractType { /** * @param FormBuilderInterface $builder * @param array $options */ $builder 'class' => 'AppBundle:Klient', 'placeholder' => 'Nr klienta', 'label' => false, 'property' => 'idklient', )) ->add('filtruj', 'submit'); ; } // // /** // * @param OptionsResolverInterface $resolver // */ // public function setDefaultOptions(OptionsResolverInterface $resolver) { // $resolver->setDefaults(array( // 'data_class' => 'AppBundle\Entity\Klient' // )); // } /** * @return string */ public function getName() { return 'idklient'; } }
3. kawałek entity Klient
/** * @var string * * @Assert\Length( * min = 6, * max = 6, * exactMessage = "Kod pocztowy powinien składać się z {{ limit }} znaków w formacie CC-CCC", * ) * * @ORM\Column(name="kodPocztowy", type="string", length=6, nullable=true) */ private $kodpocztowy;