Ticket #835 (closed defect: fixed)
sfDoctrine schema generates double model entries with Equal nest relations
| Reported by: | slickrick | Owned by: | jwage |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.10.3 |
| Component: | sfDoctrinePlugin | Version: | 0.10.0 |
| Severity: | Keywords: | ||
| Cc: | Has Test: | ||
| Status: | Has Patch: |
Description
Here is a sample of my schema:
client.yml
Client:
tableName: client
className: Client
columns:
id:
notnull: true
primary: true
autoincrement: true
type: integer
length: 11
relations:
Client:
refClass: ClientAffiliateGroup
local: client_id
foreign: affiliate_id
foreignAlias: Affiliates
equal: true
client_affiliate_group.yml
ClientAffiliateGroup:
tableName: client_affiliate_group
className: ClientAffiliateGroup
columns:
client_id:
default:
notnull: true
primary: true
type: integer
length: 11
name: client_id
affiliate_id:
default:
notnull: true
primary: true
type: integer
length: 11
name: affiliate_id
However, when my BaseClient?.php is generated, the setUp() looks like this:
public function setUp()
{
$this->hasMany('Client', array('refClass' => 'ClientAffiliateGroup',
'local' => 'client_id',
'foreign' => 'affiliate_id',
'equal' => true));
$this->hasMany('Client as Affiliates', array('refClass' => 'ClientAffiliateGroup',
'local' => 'affiliate_id',
'foreign' => 'client_id'));
}
This could be user error. However, it's duplicating the Client entry, which is causing an issue because when you try to get Client->Affiliates, it brings back the wrong results because its treating affiliate_id as the local id.
Change History
Note: See
TracTickets for help on using
tickets.