I just wanted to ask, whether there were any plans to incorporate the Null Object pattern implementation in Yii 2 among the core developers or contributors.
For the curious, rationale is that it would be really helpful when added to the concept of relations. With built-in support for Null Object creation for [font="Lucida Console"]ActiveRecord [/font]models we can have transparent empty values when using relation chains.
I mean, no more "trying to get property of null" PHP Fatal when doing chain get like
[font="Lucida Console"]$order->item->brand->name[/font] in case of broken link to
[font="Lucida Console"]brand[/font]. Just configured in advance appropriate empty value. Or even full Special Case automatic creation, with method overrides and such.
I’m asking because I’m thinking about contributing but don’t want another NIH piece of code. This can be made in relatively non-invasive way by adding traits. Also, it’ll refactor out the
[font="Lucida Console"]<span class="not-set">(не задано)</span>[/font] hardcode from [font=“Lucida Console”]GridView [/font]columns.