Symfony manyToOne可以无效工作

时间:2016-03-14 10:52:07

标签: php symfony doctrine-orm

我有两个与ManyToOne关系链接的实体:Extra和GlobalExtra。这种关系不是强制性的,因此" Extra"可能有一个null global_extra_id。

与酒店实体的其他关系运作良好,但在这种情况下,关系是强制性的,如果hotel_id永远不为空

YML Extra:

ByHours\HotelBundle\Entity\Extra:
type: entity
table: by_extras
id:
    id:
        type: integer
        nullable: false
        unsigned: false
        id: true
        generator:
            strategy: IDENTITY
fields:
    hotelId:
        type: integer
        nullable: false
        unsigned: false
        column: hotel_id
    globalExtraId:
        type: integer
        nullable: true
        column: global_extra_id
    active:
        type: integer
        nullable: true
        unsigned: false
        default: '1'
        column: active
    countable:
        type: integer
        nullable: true
        unsigned: false
        default: '0'
        column: countable
    price:
        type: decimal
        nullable: true
        precision: 10
        scale: 2
        default: '0.00'
        column: price
    image:
        type: string
        nullable: true
        length: 255
        fixed: false
    deleted:
        type: integer
        nullable: true
        unsigned: false
        default: '0'
        column: deleted
    useAmount:
        type: integer
        nullable: true
        unsigned: false
        default: '1'
        column: use_amount
    created:
        type: datetime
        nullable: true
    modified:
        type: datetime
        nullable: true
manyToOne:
    hotel_extras:
        targetEntity: ByHours\HotelBundle\Entity\Hotel
        inversedBy: extras
        joinColumn:
          name: hotel_id
          referencedColumnName: id
    global_extras:
        targetEntity: ByHours\HotelBundle\Entity\GlobalExtra
        joinColumn:
          name: global_extra_id
          referencedColumnName: id
          nullable: true
oneToMany:
    extraSchedules:
      targetEntity: ByHours\HotelBundle\Entity\ExtraSchedule
      mappedBy: extra_schedules
    extraTranslations:
      targetEntity: ByHours\HotelBundle\Entity\ExtraTranslate
      mappedBy: extra_translations
lifecycleCallbacks: {  }

YML GlobalExtra:

ByHours\HotelBundle\Entity\GlobalExtra:
type: entity
table: by_global_extras
id:
    id:
        type: integer
        nullable: false
        unsigned: false
        id: true
        generator:
            strategy: IDENTITY
fields:
    name:
        type: string
        nullable: false
        length: 255
        fixed: false
    price:
        type: decimal
        nullable: true
        precision: 10
        scale: 2
        default: '0.00'
        column: price
    image:
        type: string
        nullable: true
        length: 255
        fixed: false
    countable:
        type: integer
        nullable: true
        unsigned: false
        default: '0'
        column: countable
    created:
        type: datetime
        nullable: true
    modified:
        type: datetime
        nullable: true
lifecycleCallbacks: {  }

我总是收到以下错误:

  

[10月14日星期一:34:48.931980 2016] [fcgid:warn] [pid 17064:   139946383820544 tid] [client 10.0.2.2:54993] mod_fcgid:stderr:PHP

     

警告:需要(/选择/框架/网络/ symfony中/高速缓存/ PROD /教义/ ORM /代理/ __ CG__ByHoursHotelBundleEntityGlobalExtra.php):   无法打开流:

中没有此类文件或目录      

/var/www/Web/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php   在第207行

是的我使用以下方法清除了缓存:

php app / console cache: clear --no-warmup

并为临时文件夹分配了权限

0 个答案:

没有答案