1

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
    (...)

さらに奇妙なことに、ローカルホストではなく、本番環境でエラーが発生しました:(

編集: BaseDataPerDayFormFilter.class.php では、バリデーターは次のとおりです。

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

これでよろしいですか ?

4

1 に答える 1

0

エラーはschema.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、それがエラーの原因でした。

于 2012-04-24T12:29:52.973 に答える