Support fk column with code_ or _code#296
Support fk column with code_ or _code#296adipriyantobpn wants to merge 2 commits intoyiisoft:masterfrom adipriyantobpn:feature/patch/name
Conversation
|
Thanks for posting in our issue tracker.
Thanks! This is an automated comment, triggered by adding the label |
|
AFAIK, it is also common to use In my case, actually we are need to build REST API for a legacy desktop application. It will be nice, if string
August 2017, since at that time we'd just start the REST API development.
All relation name which it's foreign key has |
|
OK. Got it. I can't say that using Instead of introducing hardcoded |
|
@samdark |
|
Please, write unit tests for this case. |
| } elseif (substr_compare($key, 'id', 0, 2, true) === 0) { | ||
| $key = ltrim(substr($key, 2, strlen($key)), '_'); | ||
| foreach ($this->fkColumnIdentifiers as $str) { | ||
| if (!empty($key) && strcasecmp($key, $str)) { |
There was a problem hiding this comment.
What's meant by strcasecmp here? Not equal?
There was a problem hiding this comment.
Yes, i think so.
Actually i just copy that line from if (!empty($key) && strcasecmp($key, 'id')) { and change id string into $str variable accordingly.
Is there anything that i should revise?
|
@dmirogin, as a matter of fact, at this time, i don't have much experience for writing unit testing yet. |
|
Thank you for putting effort in the improvement of the Yii framework. In order for the framework and your solution to remain stable in the future, we have a unit test requirement in place. Therefore we can only accept your pull request if it is covered by unit tests. Could you add these please? Thanks! P.S. If you have any questions about the creation of unit tests? Don't hesitate to ask for support. More information about unit tests This is an automated comment, triggered by adding the label |
Add support for foreign key column like
code_supplierorsupplier_code