php - Using annotations to get a ChoiceList of Entity constatnts -
is possible utilize annotations choicelist
or array
of specific type of class/entity constants?
i mean this:
class user{ /** * @item(things,'label 1') */ const some_thing1=1; /** * @item(things,'label 2') */ const some_thing2=2; /** * @item(things,'label 3') */ const some_thing3=3; /** * @item(otherthings,'label 1') */ const some_other_thing1=1; /** * @item(otherthings,'label 2') */ const some_other_thing2=2; ... }
and then:
$builder->add('thing', 'choice', array( 'choice_list' => getchoicelistfromconsts('user','things') ));
and expect getchoicelistfromconsts('user','things')
homecoming like:
array( 'label 1' => 1, 'label 2' => 2, 'label 3' => 3 );
is there build-in feature in symfony2 or there bundle provide such service?
php symfony2 annotations
No comments:
Post a Comment