What is the best way to use “afterFind” in cake 3 ?
I would recommend you look at custom finders. They let you not only package up conditions, but also attach ‘after’ functions using
formatResults(), map/reduce to add aggregated fields, and formatResults to add calculated fields.
thanks for you answering, you have a example ? where i puth the mapReduce ? in my Table ? Entity ? I need it to be global to everyone.
If you need the same logic on each find you can either apply it in the relevant custom finders, or overload
find() and put your logic there.
i need put mask any fields … like cpf, cep, phone e etc … but i need custumize in model, heretofore i used in afterFind method.
please help me out give me the example code for afterfind in cakephp 3
The answer is in this thread. CakePHP 3 does not have