2012-04-24 42 views
1

我有以下錯誤,同時通過進口學說一些數據:爲什麼我會在Symfony 1.4上使用Doctrine保存「驗證失敗」?

value1:19.022542 
value2:497.795 
value3:9466.541667 
Caught exception: Validation failed in class DataPerDay 

    27 fields had validation errors: 

    * 1 validator failed on value1 (type) 
    * 1 validator failed on value2 (type) 
    * 1 validator failed on value3 (type) 

我不明白這個驗證錯誤! 字段的float類型,這裏可能會發生什麼?

的schema.yml:

DataPerDay: 
    connection: doctrine 
    tableName: xp_data_per_day 
    columns: 
    id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: true 
     autoincrement: true 
    inverter_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    (...) 
    value1: 
     type: float 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: false 
     autoincrement: false 
    (...) 

怪異的是,我對生產environnent的錯誤,而不是在localhost :(

編輯:在BaseDataPerDayFormFilter.class.php,該驗證程序是:

'value1'  => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))), 

這是正確的?

+0

清除緩存?您是否在某處設置了自定義驗證規則?你如何導入數據? – binarious 2012-04-24 09:30:57

+0

我在/ lib/tasks;緩存不會被顛覆發送 – Manu 2012-04-24 09:36:54

+0

如何導入數據? – binarious 2012-04-24 09:39:41

回答

0

錯誤是不是在架構.yml,但在databases.yml裏

prod: 
    doctrine: 
    class: sfDoctrineDatabase 
    param: 
     profiler: false 
     dsn: 'mysql:host=xxx.net;dbname=xxx' 
     port: 3306 
     username: xxx 
     password: xxx 
     encoding: UTF8 
     attributes: 
     quote_identifier: false 
     use_native_enum: false 
     idxname_format: %s_idx 
     seqname_format: %s_seq 
     tblname_format: %s 
     validate: all 

我不知道這個「validate: all」是從哪裏來的,但它是什麼產生這些錯誤。