You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a reason why the methods in AbstractResourceTransformer are private? It causes some problems overriding them, for example you can't override transformAttributesObject() because it is being called elsewhere in the same scope and you need to override those private methods as well.
For the record, what I want to do is extend the class and have this:
public function getAttributes($domainObject)
{
$ret = [];
foreach ($domainObject->attributes as $k=>$v) {
if ($k!=$domainObject->primaryKey()) {
$ret[$k] = function(CActiveRecord $domainObject, $attr) { return $domainObject->{$attr}; };
}
}
return $ret;
}
I actually believe the fingerprint for the closure there could include the attribute name by default, but that's something you might have considered and rejected already so...
The text was updated successfully, but these errors were encountered:
I appreciate your Pull Request and I also support the idea to include the attribute name in the anonymous function. I can't really remember why I made those methods private, but probably I just didn't think anyone would override them - but it's interesting to get to know a legal use-case which needs it!
So as soon as you fix that small typo, and I'll accept your PR!
Is there a reason why the methods in AbstractResourceTransformer are private? It causes some problems overriding them, for example you can't override transformAttributesObject() because it is being called elsewhere in the same scope and you need to override those private methods as well.
For the record, what I want to do is extend the class and have this:
I actually believe the fingerprint for the closure there could include the attribute name by default, but that's something you might have considered and rejected already so...
The text was updated successfully, but these errors were encountered: