UUID primary key

Just found out about grocery CRUD. Looked nice, got started, purchased the bootstrap theme, looked even better.

But now it all stopped since it does not seem to be possible to use a UUID as ID.

I checked these old forum posts about it:
post1
post2
post3
But it turns out, even though it is possible to in some way create a UUID ID using callback_before_insert, it will still not work for example if also defining relations with other tables.

Couldnt it be a good idea to add a $crud->callback_primary_key_generator( array($this, ‘uuid_callback’)) or similar that could take care of this issue?

I tried to patch the code and here is a diff. Seem to work, but I am not sure if it is per your guidelines. The idea is if the primary key is returned from the callback_before_insert it should ve trusted all the way thru and we should use it and not the auto generated id that is returned on such fields. Makes sense?

Diff below:

973c973
< 
---
> 		
1028a1029,1033
> 				if (array_key_exists($this->get_primary_key(), $post_data))
> 				{
> 					$insert_data[$this->get_primary_key()] = $post_data[$this->get_primary_key()];
> 				}
> 
1031c1036,1040
< 				if($insert_result !== false)
---
> 				if (array_key_exists($this->get_primary_key(), $post_data))
> 				{
> 					$insert_primary_key = $post_data[$this->get_primary_key()];
> 				}
> 				elseif($insert_result !== false)

After this patch everything seem to work, even set_relation_n_n with UUID primary keys

@johnny can you implement this?