开发者

propel:data-dump outputs only rows where self-referential fk is null - how to work around?

开发者 https://www.devze.com 2023-04-01 09:29 出处:网络
Am using Symfony 1.4 and Propel 1.6. I have a table representing an object where one may record may relate to one other record in the table (Think outbound / inbound routes). The key of second half of

Am using Symfony 1.4 and Propel 1.6. I have a table representing an object where one may record may relate to one other record in the table (Think outbound / inbound routes). The key of second half of the pair (think inbound route) is stored in the first instance (the outbound one).

This project is in development. I am trying to make a data dump. What happens is that I do not get all of the records output from MySQL. Only where the self-referencing column is NULL will I get an output.

How do I tell propel to output the integer value stored in this linked column?

Note: table not actually called Route, this just a placeholder name for the real-world object (does not model links or routing object or invoke such naming issues)

Route:

id: ~
linked_Route_id: 
  type: INTEGER
  foreignTable: Route
  foreignReference: id
  onDelete: setnull
  fkSkipSql: true  #I have tr开发者_运维技巧ied builds with and without this option.

..... Thanks for any recommendations from someone who has had to work around the issue before.


I think you cannot achieve what you want and it's more related to the Propel plugin for symfony than Propel itself. The data dump/load tasks have a specific process for symfony, so you won't get raw data but more in a symfony compliant formatting.

You may be able to get what you want by using the Propel command line: http://www.propelorm.org/cookbook/working-with-existing-databases.html#dumping_data_to_xml but it can be not perfect.

You could use the mysqldump command otherwise.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号