#1666: Data Export Doesn't export the keys correctly.
-----------------------------------+----------------------------------------
Reporter: marijn | Owner: jwage
Type: defect | Status: new
Priority: major | Milestone: 1.0.4
Component: Import/Export | Version: 1.0.3
Keywords: export data fixture | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 0
-----------------------------------+----------------------------------------
= Problem set: =
I'm using Doctrine in combination with symfony, when exporting data the
following errors occur:
{{{
$ symfony doctrine:data-dump ApplicationName fixture_file.yml
>> Invalid argument supplied for foreach() in
plugins/sfDoctrinePlugin/lib/doctrine/Doctrine/Data/Export.php on line 163
>> doctrine Dumped data successfully to: /data/fixtures/fixture_file.yml
}}}
I've had a look at that line but the only thing happening there is a
`toArray(false)` call on the `Doctrine_Record` that is to be exported.
The fixture file that is produced is unusable. If I call a reload
procedure it doesn't load the data.
== Example: ==
The error can be regenerated with the following schema:
{{{
Asset:
columns:
id: { type: integer, length: 4, primary: true,
autoincrement: true }
name: { type: string, length: 255 }
description: { type: string, length: 255 }
mime_type: { type: enum, values: [ image/jpeg, image/png,
image/gif ] }
actAs:
Versionable: { versionColumn: version, className: %CLASS%Version,
auditLog: true }
Sluggable: { unique: true, fields: [ name ], canUpdate: false }
Timestampable: { created: { name: created_at }, updated: { name:
updated_at } }
SoftDelete: { }
ImageAsset:
inheritance:
extends: Asset
type: column_aggregation
keyField: content_type
keyValue: 1
}}}
Create the following fixture files, 001_assets.yml:
{{{
Asset: { }
}}}
002_image_assets.yml:
{{{
ImageAsset:
test_image_asset_1:
name: Test Image 1
description: Description Test Image 1
mime_type: image/jpeg
test_image_asset_2:
name: Test Image 2
description: Description Test Image 2
mime_type: image/gif
test_image_asset_3:
name: Test Image 3
description: Description Test Image 3
mime_type: image/png
}}}
Rebuild the model:
{{{
$ symfony doctrine:build-all-reload ApplicationName
}}}
Check if all is loaded correctly:
{{{
$ symfony doctrine:dql Test "SELECT a.* FROM Asset a"
}}}
Drop the data
{{{
$ symfony doctrine:data-dump ApplicationName incorrect_data.yml
>> Invalid argument supplied for foreach() in
plugins/sfDoctrinePlugin/lib/doctrine/Doctrine/Data/Export.php on line 163
>> doctrine Dumped data successfully to:
/data/fixtures/incorrect_data.yml
}}}
Try to reload:
{{{
$ symfony doctrine:build-all-reload ApplicationName
>>`Invalid row key specified: ImageAsset_1`
}}}
The error is the result of the incorrect keys in the generated fixtures
file.
== Environment: ==
* Symfony 1.1.4
* [http://trac.symfony-
project.org/browser/plugins/sfDoctrinePlugin/branches/1.1?rev=12938
sfDoctrinePlugin]
* [source:/branches/1.0/lib#5173 "Doctrine 1.0.3"]
*PHP 5.2.4
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1666>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---