Ticket #1369 (closed defect: fixed)
Bug in Doctrine_Data_Export::prepareData()
| Reported by: | wolfpakz | Owned by: | jwage |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | Attributes | Version: | 1.0.0 |
| Severity: | Keywords: | ||
| Cc: | Has Test: | yes | |
| Status: | Pending Core Response | Has Patch: | yes |
Description
This method incorrectly excludes some record information. The cases I have run into so far are empty string fields and boolean fields with a 'false' value. The offending code is commented below:
public function prepareData($data)
{
$preparedData = array();
foreach ($data AS $className => $classData) {
foreach ($classData as $record) {
$className = get_class($record);
$recordKey = $className . '_' . implode('_', $record->identifier());
$recordData = $record->toArray(false);
foreach ($recordData as $key => $value) {
/*
* This condition is the problem.
*/
if ( ! $value) {
continue;
}
-- cut --
I expect boolean fields with a false value to dump their values as "false". What actually happens is the boolean field is ommitted entirely. This is also the case with an empty string field. The problem becomes apparent when you later try to load the data. If those fields have 'notnull' on them, you get validation exceptions because the values are completely missing.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.