Changeset 3679
- Timestamp:
- 03/29/07 18:00:01 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfDoctrinePlugin/addon/sfDoctrineRelationSchema.class.php
r3675 r3679 68 68 { 69 69 // special behaviour for xref tables with cascade delete 70 $ verb = 'has';71 if ($this->get('cascadeDelete') && $this->get('counterpart'))72 $ verb = 'owns';70 $options = ''; 71 if ($this->get('cascadeDelete') && ( $this->get('counterpart') || $this->get('unique')) ) 72 $options = ", 'onDelete'=>'cascade'"; 73 73 74 return "\$this-> $verb"."One('{$this->get('foreignClass')} as {$this->get('foreignName')}', '{$this->get('localClass')}.{$this->get('localReference')}', array('foreign' => '{$this->get('foreignReference')}'));";74 return "\$this->hasOne('{$this->get('foreignClass')} as {$this->get('foreignName')}', '{$this->get('localClass')}.{$this->get('localReference')}', array('foreign' => '{$this->get('foreignReference')}' $options));"; 75 75 } 76 76 … … 93 93 94 94 // using "owns" for cascade delete except in xref tables 95 $ verb = 'has';95 $options = ''; 96 96 if ($this->get('cascadeDelete') && !$this->get('counterpart')) 97 $ verb = 'owns';97 $options = ", array( 'onDelete'=>'cascade')"; 98 98 99 return "\$this->$verb$quantity('$otherClass as {$this->get('localName')}', '{$this->get('localClass')}.$localReference');"; 99 100 return "\$this->has$quantity('$otherClass as {$this->get('localName')}', '{$this->get('localClass')}.$localReference' $options);"; 100 101 } 101 102