पर विकल्प के माध्यम से गुज़रने के दौरान विकल्प त्रुटि मौजूद नहीं है, मुझे अपने buildForm
विधि में से किसी एक रूप में एक विकल्प से गुज़रने का प्रयास करते समय निम्न त्रुटि मिलती है।नियंत्रक से एम्बेडेड सिम्फनी फॉर्म
विकल्प "numOfHoles" मौजूद नहीं है। परिभाषित विकल्प हैं: "क्रिया", "allow_extra_fields", "attr", "auto_initialize", "block_name", "by_reference", "cascade_validation", "compound", "बाधाएं", "csrf_field_name", "csrf_message", " csrf_protection "," csrf_provider "," csrf_token_id "," csrf_token_manager "," data "," data_class "," अक्षम "," blank_data "," error_bubbling "," error_mapping "," extra_fields_message "," legisl_data "," इरादा " , "invalid_message", "invalid_message_parameters", "लेबल", "label_attr", "label_format", "मैप किया गया", "max_length", "विधि", "पैटर्न", "post_max_size_message", "property_path", "read_only", " आवश्यक "," translation_domain "," trim "," validation_groups "," वर्चुअल "।
मेरी नियंत्रक में:
// hardcoded here for brevity in this example
$form = $this->createForm('crmpicco_course_row', $courseRow, array('numOfHoles' => 18));
में crmpicco_course_row
फार्म वर्ग:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', 'text')
->add('course', 'crmpicco_course', array('numOfHoles' => $options['numOfHoles']))
;
}
में crmpicco_course
फार्म वर्ग:
public function buildForm(FormBuilderInterface $builder, array $options)
{
for ($i = 0; $i < $options['numOfHoles']; $i++) {
$builder->add($i, 'text', array('required' => 'false'));
}
}
/**
* @return string name
*/
public function getName()
{
return 'crmpicco_course';
}
किसी को भी देख सकते हैं क्यों विकल्प numOfHoles
नहीं है पी के माध्यम से झुकाव?
आपको अपने फॉर्म बिल्डर के 'कॉन्फ़िगरेशनऑप्शन (विकल्प रीसोलवर $ रिज़ॉल्वर) 'के अंदर' setDefaults' या 'setRequired' फ़ंक्शन' का उपयोग करके 'numOfHoles' विकल्प' जोड़ना होगा। –