Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Inconsistent code while handling CManyManyRelation #636
"Many-To-Many" relation in active record is specified by the string in following format:
The main critical information about "many-to-many" relationship is specified by the last string parameter, which determines the connector table and foreign keys. This makes "CActiveRecord::MANY_MANY" much different from the other relations.
While I attempt to craete an active record behavior, which handles the saving of "many-to-many" relation data, I found I have to perform the same "preg_match" functionality to retrieve the data I need form "CManyManyRelation" instance. That makes this code to be duplicated.
I suggest the class "CManyManyRelation" should be extended. Methods "CManyManyRelation::getConnectorTableName()" and "CManyManyRelation::getForeighKeys()" should be added. This methods should perform internal "preg_match" call and fill up the internal protected fields with the corresponding data.
I am using framework version 1.1.10
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
@klimov-paul I've reported the same issue in a different way in #508. your solution looks like the better one on first sight.