EDIT/CLARIFICATION: This question is asking where to hook the conversion into CakePHP 3.x. I know how to convert bin to hex. The question is where, in the CakePHP 3.x model structure, to intercept and change the result row(s).
I'm storing UUID data as varbinary(16) in MySQL tables. This is NOT a primary key. When I read this field, I'd like to have it converted to the standard 36-character string (binary to hex with hyphens inserted) in PHP. In CakePHP 2.x I would have used the afterFind() callback. The CakePHP 3.x documentation says to use Map/Reduce, but that would mean locating every find() in the code. It seems like I should be able to accomplish this in the model, perhaps as a CakePHP 3 Behavior.
The table looks like this:
create table `books` (
`id` int(10) unsigned not null auto_increment,
`my_uuid` varbinary(16) not null,
`created` timestamp not null default current_timestamp on update current_timestamp,
primary key (`id`),
) engine=InnoDB;
Note that I'm only asking about reading from the database. Insert and update are working fine. I'd like to convert from binary to string on read, and I think I should be doing that in the Model layer (table/entity).