2010-09-27 50 views
0

InvalidArgumentException部件「注意」不存在Symfony的InvalidArgumentException部件「注意」不存在

當我刪除「注意」,「驗證碼」給出了同樣的錯誤。這兩個字段都不在數據庫中。我有這個工作更早,直到我試圖從行動傳遞一個變量的形式。我拿了出來,但我仍然有一個錯誤

任何想法我做錯了什麼?感謝:

基本形式:

abstract class BaseItemsForm extends BaseFormDoctrine 
{ 
    public function setup() 
    { 

    $this->widgetSchema->setNameFormat('items[%s]'); 

    $this->setWidgets(array(
     'city_id'   => new sfWidgetFormInputText(), 
     'state_id'  => new sfWidgetFormInputText(), 
     'item_id'   => new sfWidgetFormInputHidden(), 
     'name'   => new sfWidgetFormInputText(), 
     'address'   => new sfWidgetFormInputText(), 
     'city'   => new sfWidgetFormInputText(), 
     'state'   => new sfWidgetFormInputText(), 
     'zip'    => new sfWidgetFormInputText(), 
     'zip9'   => new sfWidgetFormInputText(), 
     'county'   => new sfWidgetFormInputText(), 
     'url'    => new sfWidgetFormInputText(), 
     'phone'   => new sfWidgetFormInputText(), 
     'fax'    => new sfWidgetFormInputText(), 
     'owner'   => new sfWidgetFormInputText(), 
     'title'   => new sfWidgetFormInputText(), 
     'gender'   => new sfWidgetFormInputText(), 
     'employee'  => new sfWidgetFormInputText(), 
     'sales'   => new sfWidgetFormInputText(), 
     'category_id'  => new sfWidgetFormInputText(), 
     'attention'  => new sfWidgetFormChoice(array(
    'choices' => Doctrine_Core::getTable('Items')->getAttn(), 
    'multiple' => false, 'expanded' => false)), 
     'captcha'   => new sfWidgetFormReCaptcha(array(
    'public_key' => '******' 
)), 
     'sic_description' => new sfWidgetFormInputText(), 
     'custom'   => new sfWidgetFormInputText(), 
     'added'   => new sfWidgetFormDateTime(), 
     'user_id'   => new sfWidgetFormInputText(), 
     'logo'   => new sfWidgetFormInputText(), 
     'approved'  => new sfWidgetFormInputText() 
    )); 




    $this->setValidators(array(
     'city_id'   => new sfValidatorInteger(), 
     'state_id'  => new sfValidatorInteger(), 
     'item_id'   => new sfValidatorChoice(array('choices' => array($this->getObject()->get('item_id')), 'empty_value' => $this->getObject()->get('item_id'), 'required' => false)), 
     'name'   => new sfValidatorString(array('max_length' => 255)), 
     'address'   => new sfValidatorString(array('max_length' => 255)), 
     'city'   => new sfValidatorString(array('max_length' => 64)), 
     'state'   => new sfValidatorString(array('max_length' => 2)), 
     'zip'    => new sfValidatorString(array('max_length' => 5)), 
     'zip9'   => new sfValidatorString(array('max_length' => 10)), 
     'county'   => new sfValidatorString(array('max_length' => 64)), 
     'url'    => new sfValidatorString(array('max_length' => 255, 'required' => false)), 
     'phone'   => new sfValidatorString(array('max_length' => 32)), 
     'fax'    => new sfValidatorString(array('max_length' => 32, 'required' => false)), 
     'owner'   => new sfValidatorString(array('max_length' => 128)), 
     'title'   => new sfValidatorString(array('max_length' => 128)), 
     'gender'   => new sfValidatorString(array('max_length' => 6)), 
     'employee'  => new sfValidatorString(array('max_length' => 6)), 
     'sales'   => new sfValidatorString(array('max_length' => 16)), 
     'category_id'  => new sfValidatorString(array('max_length' => 10)), 
     'attention'  => new sfValidatorString(array('max_length' => 50, 'required' => false)), 
     'captcha'   => new sfValidatorReCaptcha(array(
    'private_key' => '******' 
)), 
     'sic_description' => new sfValidatorString(array('max_length' => 128)), 
     'custom'   => new sfValidatorInteger(), 
     'added'   => new sfValidatorString(array('max_length' => 255)), 
     'user_id'   => new sfValidatorInteger(), 
     'logo'   => new sfValidatorString(array('max_length' => 50, 'required' => false)), 
     'approved'  => new sfValidatorInteger(array('required' => false)), 
    )); 



    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); 

    $this->setupInheritance(); 

    parent::setup(); 
    } 

    public function getModelName() 
    { 
    return 'Items'; 
    } 

} 

形式

class ItemsUserForm extends BaseItemsForm 
{ 
    public function setUserId($id) 
    { 
    $this->getObject()->setUser_id($id); 
    } 
    public function configure() 
    { 
     unset(
     $this['zip9'], 
     $this['city_id'], $this['state_id'], 
     $this['county'], $this['url'], 
     $this['title'], $this['gender'], 
     $this['employee'], $this['sales'], 
     $this['custom'], 
     $this['added'], $this['user_id'], 
     $this['logo'] 
    ); 

    $this->widgetSchema->setLabels(array(
     'owner' => 'Your Name:*', 
     'phone' => 'Your Phone:*', 
     'fax' => 'Your Fax:*', 
     'name' => 'Business Name:*', 
     'address' => 'Business Address:*', 
     'city' => 'City:*', 
     'state' => 'State:*', 
     'zip' => 'Zipcode:*', 
     'category_id' => 'Category/Keyword:*', 
     'attention'  => 'Attention:*', 
     'sic_description' => 'Business Description Message:*', 
     'captcha' => 'Image Verification:*' 
    )); 
    } 

} 

行動

public function executeNew(sfWebRequest $request) 
    { 
    $this->form = new itemsUserForm(); 
    } 

回答

0

我發現這個問題。

我忘了在executeCreate中更改表單。我改變了行,以反映executeNew,現在它的工作。