Ticket #1665 (closed defect: invalid)

Opened 8 months ago

Last modified 7 months ago

Insert and dump data problems with one to many and one to one multiple relations between two tables

Reported by: dominicclifton Owned by: jwage
Priority: major Milestone: 1.0.5
Component: Attributes Version: 1.0.3
Severity: Keywords: import export dump load relation
Cc: Has Test: no
Status: Pending Core Response Has Patch: no

Description

I am having problem dumping and re-importing data correctly,

The attached file documents the simplest schema that isolates the problem, shows mysql data insert commands, the doctrine commands used to dump the data, the dumped data and the error that occurs when importing the data.

Attachments

doctrine-ticket-1665.txt (5.5 KB) - added by dominicclifton 8 months ago.

Change History

Changed 8 months ago by dominicclifton

Changed 8 months ago by jwage

  • milestone changed from Unknown to 1.0.4

Changed 7 months ago by jwage

  • status changed from new to closed
  • resolution set to fixed

(In [5305]) [1.0, 1.1] Fixes issue with data fixtures exporting with foreign keys (closes #1665)

Changed 7 months ago by jwage

A bug did exist in the data fixtures exporting, but your schema is also wrong. Your id columns need to have autoincrement defined on them.

Changed 7 months ago by dominicclifton

  • status changed from closed to reopened
  • resolution fixed deleted

Thanks for take a look and fixing some of the issues I'm having.

However I'm still unable to dump and re-import the data correctly, I still get the error message: "SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'owner_id' cannot be null"

In my case the 'id' column forms the table's natural index and is not an auto-incremented or sequence column.

"3.6.2 Natural - Natural identifier is a property or combination of properties that is unique and non-null. The use of natural identifiers is encouraged."

Changed 7 months ago by jwage

  • status changed from reopened to closed
  • resolution set to invalid

You have id which is primary, but it not autoincrement. It needs to be autoincrement or you need to handle the setting of the id yourself using sequences or something. Owner id is blank because when the referenced Owner is saved, the id is not autoincremented to a value, so the owner_id is not set because no id exists. Your schema is invalid.

Note: See TracTickets for help on using tickets.