Symfony2 Validator致命错误

时间:2013-02-02 11:46:56

标签: php symfony yaml

我创建了一个symfony包,它在我创建时工作,但是当我把它移到其他地方时它给了我以下错误:

  

致命错误:在/ home / nagel / sites / battlemamono / vendor / symfony / symfony / src / Symfony / Component / Validator / Mapping / Loader / AbstractLoader中找不到类'Symfony \ Component \ Validator \ Constraints \ type'。第63行的PHP

这是一个验证器错误,我唯一的验证器就是:

Battlemamono\DatabaseBundle\Entity\Mamono:
    constraints:
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity: 
            fields: name
            message: A mamono with this name already exists.
            groups: [creation]
properties:
    id:
        - type: integer

    name:
        - NotBlank: ~
        - MaxLength: 30
        - type: string

    family1:
        - NotBlank: ~
        - MaxLength: 30
        - type: string
        - Choice : { callback: getFamily }

    family2:
        - MaxLength: 30
        - type: string
        - Choice : { callback: getFamily }

    element1:
        - NotBlank: ~
        - MaxLength: 30
        - type: string
        - Choice : { callback: getElements }

    element2:
        - MaxLength: 30
        - type: string
        - Choice : { callback: getElements }

    disposition:
        - NotBlank: ~
        - MaxLength: 100
        - type: string
    diet:
       - NotBlank: ~
       - MaxLength: 100
       - type: string

    previousForm:
       - MaxLength: 30
       - type: string

    nextForm:
       - MaxLength: 30
       - type: string

    evolution:
       - MaxLength: 30
       - type: string

    evolutionLove:
      - type: bool

    tags:
      - type: string
      - MaxLength: 100

    description:
     - type: string
     - NotBlank: ~

我不知道为什么会这样做。

1 个答案:

答案 0 :(得分:0)

你的格式错误,这就是文档所说的:

Acme\BlogBundle\Entity\Author:
    properties:
        age:
            - Type:
                type: integer
                message: The value {{ value }} is not a valid {{ type }}.

来自http://symfony.com/doc/current/reference/constraints/Type.html