Open
Description
I have problem with relations one-to-many. I have two entities: company and related table company_images (with company_id column).
Here is part of my company-generator.yml:
embed_types:
- "CompanyImageAdmin-generator.yml"
fields:
images:
label: Images
dbType: collection
formType: collection_upload
addFormOptions:
nameable: false
editable: [ file ]
primary_key: id
#
### you can create your own form type
# type: \Acme\DemoBundle\Form\MyFormType
#
### or use admin:generate-admin command and use the admingenerated form type
type: \Acme\CompanyBundle\Form\Type\CompanyImageAdmin\EditType
#
maxNumberOfFiles: 5
maxFileSize: 500000
minFileSize: 1000
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
loadImageFileTypes: /^image\/(gif|jpe?g|png)$/i
loadImageMaxFileSize: 250000
previewMaxWidth: 100
previewMaxHeight: 100
previewAsCanvas: true
prependFiles: false
allow_add: true
allow_delete: true
error_bubbling: false
options:
data_class: Acme\CompanyBundle\Entity\CompanyImage
When I try submit form I have error
An exception occurred while executing 'INSERT INTO company_image (active, name, file, created, updated, company_id) VALUES (?, ?, ?, ?, ?, ?)' with params [null, "test.jpg", {}, "2013-08-09 10:07:54", "2013-08-09 10:07:54", null]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'company_id' cannot be null
How I should do this in right way?