#1419: Related Objects are not saved if Parent is not Modified.
-------------------------+--------------------------------------------------
Reporter: buennagelj | Owner: romanb
Type: defect | Status: reopened
Priority: major | Milestone: 1.0.1
Component: Relations | Version: 1.0.0
Resolution: | Keywords:
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 0 |
-------------------------+--------------------------------------------------
Changes (by dmuldia):
* status: closed => reopened
* resolution: worksforme =>
Comment:
Encountered same problem. Parent class Address doesn't cascade save to
child class Coordinate, when only Coordinate has been changed.
Address:
public function setTableDefinition()
{
// Options
$this->option('charset', 'utf8');
$this->option('type', 'InnoDB');
// Columns
$this->hasColumn('id', 'integer', 4, array('notnull' => true,
'primary' => true,
'autoincrement' =>
true));
$this->hasColumn('country_id', 'integer', 4);
$this->hasColumn('county_id', 'integer', 4);
$this->hasColumn('city_id', 'integer', 4);
$this->hasColumn('region_id', 'integer', 4);
$this->hasColumn('zip', 'string', 32);
$this->hasColumn('street', 'string', 128);
}
public function setUp()
{
$this->hasOne('Country', array('local' => 'country_id',
'foreign' => 'id',
'onDelete' => 'SET NULL'));
$this->hasOne('County', array('local' => 'county_id',
'foreign' => 'id',
'onDelete' => 'SET NULL'));
$this->hasOne('City', array('local' => 'city_id',
'foreign' => 'id',
'onDelete' => 'SET NULL'));
$this->hasOne('Region', array('local' => 'region_id',
'foreign' => 'id',
'onDelete' => 'SET NULL'));
$this->hasOne('Coordinate', array('local' => 'id',
'foreign' => 'address_id'));
$this->hasOne('Establishment', array('local' => 'id',
'foreign' => 'address_id',
'cascade' => array('delete' => true)));
$this->hasOne('Company', array('local' => 'id',
'foreign' => 'address_id',
'cascade' => array('delete' => true)));
}
Coordinate:
public function setTableDefinition()
{
// Options
$this->option('charset', 'utf8');
$this->option('type', 'InnoDB');
// Columns
$this->hasColumn('id', 'integer', 4, array('notnull' => true,
'primary' => true,
'autoincrement' =>
true));
$this->hasColumn('address_id', 'integer', 4);
$this->hasColumn('address_string', 'string', 255, array('unique'
=> true));
$this->hasColumn('lat', 'float');
$this->hasColumn('lng', 'float');
}
public function setUp()
{
$this->hasOne('Address', array('local' =>
'address_id',
'foreign' => 'id',
'onDelete' => 'cascade'));
}
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1419#comment:3>
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
-~----------~----~----~----~------~----~------~--~---