CodeIgniter Forums
Where does the getRecent() method originate from? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1)
+--- Forum: Lounge (https://forum.codeigniter.com/forumdisplay.php?fid=3)
+--- Thread: Where does the getRecent() method originate from? (/showthread.php?tid=88190)

Pages: 1 2


RE: Where does the getRecent() method originate from? - sammyskills - 08-09-2023

(08-09-2023, 06:10 PM)kenjis Wrote:
(08-09-2023, 06:01 PM)sammyskills Wrote: Oh, I get you. For that to work, the method will need to be added to the system/Model's class phpdoc @method keyword.
WDYT @kenjis ?

Yes, if a Query Builder method returns $this and the method can be used in Models without problems,
we can add to the system/Model's class phpdoc @method keyword.
Adding it is fine by me.

Both the when() and whenNot() methods are conditional traits and they return $this. Also, they work well in models without any problems.

Just a question, since they are not new methods, is there any need for tests for this purpose?


RE: Where does the getRecent() method originate from? - kenjis - 08-09-2023

I think it is better to have tests for Model and when()/whenNot().


RE: Where does the getRecent() method originate from? - sammyskills - 08-17-2023

I've submitted a PR https://github.com/codeigniter4/CodeIgniter4/pull/7836