Created
September 6, 2012 18:11
-
-
Save weierophinney/3659074 to your computer and use it in GitHub Desktop.
annotation for radio element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Zend\Form\Annotation; | |
class Foo | |
{ | |
/** | |
* @Annotation\Type("Zend\Form\Element\Radio") | |
* @Annotation\Options({"label": "Your Choice:", "value_options":{"foo":"bar", "bar":"baz"}}) | |
*/ | |
public $choice; | |
} |
Figured it out... the correct way is this:
<?php
use Zend\Form\Annotation;
class Foo
{
/**
* @Annotation\Type("Zend\Form\Element\Radio")
* @Annotation\Options({
* "label":"Here are your choices:",
* "value_options":{"foo":"bar", "bar":"baz"}
* })
*/
public $choice;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thu Sep 06 20:17:41 2012] [error] [client 192.168.50.1] PHP Fatal error: Uncaught exception 'Zend\Form\Exception\DomainException' with message 'Zend\Form\View\Helper\FormMultiCheckbox::render requires that the element has "value_options"; none found' in /var/www/html/vendor/zendframework/zendframework/library/Zend/Form/View/Helper/FormMultiCheckbox.php:211\nStack trace:\n#0 /var/www/html/vendor/zendframework/zendframework/library/Zend/Form/View/Helper/FormMultiCheckbox.php(388): Zend\Form\View\Helper\FormMultiCheckbox->render(Object(Zend\Form\Element\Radio))\n#1 /var/www/html/vendor/zendframework/zendframework/library/Zend/Form/View/Helper/FormElement.php(130): Zend\Form\View\Helper\FormMultiCheckbox->__invoke(Object(Zend\Form\Element\Radio))\n#2 /var/www/html/vendor/zendframework/zendframework/library/Zend/Form/View/Helper/FormElement.php(211): Zend\Form\View\Helper\FormElement->render(Object(Zend\Form\Element\Radio))\n#3 [internal function]: Zend\Form\View\Helper\FormElement->__invoke(Object(Zend\Form\Element\Radio))\n#4 /var/www/html/vendor/zendframework/zendframework/library/Zend/Vi in /var/www/html/vendor/zendframework/zendframework/library/Zend/Form/View/Helper/FormMultiCheckbox.php on line 211