Development

#4418 (sfPropelData->loadDataFromArray() fails with composed foreign keys)

You must first sign up to be able to contribute.

Ticket #4418 (new defect)

Opened 2 years ago

sfPropelData->loadDataFromArray() fails with composed foreign keys

Reported by: garak Assigned to: fabien
Priority: minor Milestone:
Component: sfPropelPlugin Version: 1.1.2
Keywords: Cc:
Qualification: Unreviewed

Description

If you have a composed foreign key, loadDataFromArray() fails because it tries to check each single key as if it would a simple key (so, not considering it's only a part of a composed one)

Issue is in the following lines:

if ($column->isForeignKey() && !is_null($value))
{
  $relatedTable = $this->dbMap->getTable($column->getRelatedTableName());
  if (!isset($this->object_references[$relatedTable->getPhpName().'_'.$value]))
  {
    throw new InvalidArgumentException(sprintf('The object "%s" from class "%s" is not defined in your data file.', $value, $relatedTable->getP
  }
  $value = $this->object_references[$relatedTable->getPhpName().'_'.$value]->getByName($column->getRelatedName(), BasePeer::TYPE_COLNAME);
}

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.