afterFind in Cake 3


#1

What is the best way to use “afterFind” in cake 3 ?


#2

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.


#3

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.


#4

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.


#5

i need put mask any fields … like cpf, cep, phone e etc … but i need custumize in model, heretofore i used in afterFind method.


#6

please help me out give me the example code for afterfind in cakephp 3


#7

The answer is in this thread. CakePHP 3 does not have afterFind.