0

我创建了一个 symfony 包,在创建它时可以使用,但是当我将它移到其他地方时,它给了我以下错误:

致命错误:在线 /home/nagel/sites/battlemamono/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php 中找不到类“Symfony\Component\Validator\Constraints\type” 63

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

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: ~

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

4

1 回答 1

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

于 2013-02-02T13:00:05.297 回答