Symfony error with form entity class -
i'm trying add validation rules form using callbacks few choice fields. callback saw in documentation should in entity class form. in case i'm having time problem:
"contexterrorexception: notice: array string conversion in /applications/mamp/htdocs/bbc/vendor/symfony/symfony/src/symfony/component/form/extension/core/choicelist/choicelist.php line 462"
my code in entity looks this:
namespace cgboard\appbundle\forms; use cgboard\appbundle\classes\iplayer; class searchentity { public $category; public $coming_soon_within; public $local_radio; public $masterbrand; public $max_tleos; public $media_set; public $page; public $perpage; public $q; public $search_availibity; public $service_type; public $signed; public static function getcategories() // getters firing error, why? { return ['undef', 'arts', 'cbcc', 'comedy']; } public static function getlocalradio() { ......
i want use these callbacks validation.yml file, looks one:
cgboard\appbundle\forms\searchentity: properties: category: - choice: { callback: getcategories } coming_soon_within: - range: min: 1 max: 168 local_radio: - choice: { callback: getlocalradio } masterbrand: - choice: { callback: getmasterbrand } ....
even if delete whole content validation.yml still have error. think problem entity form class. idea how work around problem?
because think can handy else. problem was using getters (getlocalradio instance) creating conflicts internal getters used symfony. changed name of these getter , worked fine
Comments
Post a Comment