Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [SF][Symfony2][Symfony] Data Transformer problem
aras785
post 8.07.2015, 11:20:42
Post #1





Grupa: Zarejestrowani
Postów: 859
Pomógł: 177
Dołączył: 29.10.2009

Ostrzeżenie: (0%)
-----


Cześć.

Zainstalowałem: https://github.com/PUGX/PUGXAutoCompleterBu...es/doc/index.md (select2). Troche musiałem zmienić w js ale formularz działa poprawnie (znaczy się pole wyszukuje poprawnie).

Ale niestety gdy chcę zapisać pole to dostaję błąd:


w kontrolerze daję:
  1. $form = $this->createFormBuilder($company)
  2. ->add('email','text',array('label'=>'Email'))
  3. ->add('name','text',array('label'=>'Nazwa'))
  4. ->add('street','text',array('label'=>'Ulica'))
  5. ->add('id_city','autocomplete',array('label'=>'Miasto','class'=>'Acme\Bundle\AdminBundle\Entity\City'))
  6. ->add('state','choice',array('label'=>'Województwo','choices'=>array('Dolnośląskie','Opolskie')))
  7. ->add('zipcode','text',array('label'=>'Kod pocztowy'))
  8. ->add('phone','text',array('label'=>'Telefon'))
  9. ->add('nip','text',array('label'=>'NIP'))
  10. ->add('website','text',array('label'=>'Website'))
  11. ->add('save', 'submit', array('label' => 'Zapisz'))
  12. ->getForm();

Entity dla company:
  1. ...
  2. /**
  3.   * Set idCity
  4.   *
  5.   * @param \Acme\Bundle\AdminBundle\Entity\City $idCity
  6.   * @return Company
  7.   */
  8. public function setIdCity(\Acme\Bundle\AdminBundle\Entity\City $idCity = null)
  9. {
  10. $this->idCity = $idCity;
  11.  
  12. return $this;
  13. }
  14.  
  15. /**
  16.   * Get idCity
  17.   *
  18.   * @return \Acme\Bundle\AdminBundle\Entity\City
  19.   */
  20. public function getIdCity()
  21. {
  22. return $this->idCity;
  23. }

Entity City wygląda stand. ID | Name itd.

A tutaj transfermer i formularz typu: autocomplete:
https://github.com/PUGX/PUGXAutoCompleterBu...ree/master/Form

Dziękuje.

pozdrawiam
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 08:27