JaquelineBrandao / yii

Automatically exported from code.google.com/p/yii
0 stars 0 forks source link

Some CActiveRecordMetaData reforming (BC) #943

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Maybe it's good idea to move this peace of code
if(isset($config[0],$config[1],$config[2]))  // relation class, AR class, FK
    $this->relations[$name]=new
$config[0]($name,$config[1],$config[2],array_slice($config,3));
to CActiveRecordMetaData::addRelation(...config here...) method and create
CActiveRecordMetaData::hasRelation() and
CActiveRecordMetaData::removeRelation(). Possibility to manage relations
dinamicaly will be great. And it's full BC.

I create some AR behavior and use it since 1.0.x. Just for example there is
file with it. If you decide that it's good idea, maybe include this ench in
core? (it's full BC)

Original issue reported on code.google.com by creocoder@gmail.com on 19 Feb 2010 at 5:18

Attachments:

GoogleCodeExporter commented 9 years ago
Because CActiveRecordMetaData::relations is a public property, you can directly
manipulate this array to achieve add/update/delete a relation.

Original comment by qiang.xue on 19 Feb 2010 at 9:59

GoogleCodeExporter commented 9 years ago
Thanks for contributing the behavior code. I think it is more appropriate as a 
3rd
party extension rather than a core class.

Original comment by qiang.xue on 19 Feb 2010 at 10:01

GoogleCodeExporter commented 9 years ago
Let's do it in CActiveRecordMetaData to avoid adding new methods to 
CActiveRecord
(the more methods we have in CActiveRecord, the more likely we may have name 
conflict
in application code.)

Original comment by qiang.xue on 13 Mar 2010 at 7:20

GoogleCodeExporter commented 9 years ago
Let's do it in CActiveRecordMetaData to avoid adding new methods to 
CActiveRecord
(the more methods we have in CActiveRecord, the more likely we may have name 
conflict
in application code.)

Original comment by qiang.xue on 13 Mar 2010 at 7:21

GoogleCodeExporter commented 9 years ago
Yes. My first post about it :)
>to CActiveRecordMetaData::addRelation(...config here...) method

Original comment by creocoder@gmail.com on 13 Mar 2010 at 11:04

GoogleCodeExporter commented 9 years ago

Original comment by alexander.makarow on 13 Mar 2010 at 11:39

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1911.

Original comment by alexander.makarow on 14 Mar 2010 at 10:52