I have a bunch of articles, each article can have one author. If the user does not choose an author, some default name is printed instead. I thought I would use simple e() function, so I wrote:
It worked only in case every article had an author. If only one article did not have an author, I got error message: Call to a member function name() on null. For whatever reason, the condition in e() is evaluated to true (I think) even when the author is not chosen.
The parameters get evaluated during their processing, and that’s why the error is thrown. Try if that works: <?= $article->author()->toUser()->name() ?? "Admin">