I have two entities linked with a ManyToOne relationship: Extra and GlobalExtra.The relationship is not mandatory, so that "Extra" may have a null global_extra_id.
The other relationship with the entity of Hotel works well but in this case the relationship is mandatory and if hotel_id is never null
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: { }
And I always get the following error:
[Mon Mar 14 October: 34: 48.931980 2016] [fcgid: warn] [pid 17064: 139946383820544 tid] [client 10.0.2.2:54993] mod_fcgid: stderr: PHP
Warning:require(/opt/framework/Web/symfony/cache/prod/doctrine/orm/Proxies/__CG__ByHoursHotelBundleEntityGlobalExtra.php): failed to open stream: No such file or directory in
/var/www/Web/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php on line 207
Yes I have cleared cache using:
php app / console cache: clear --no-warmup
and assigned permissions to the temporary folder