Closed arcijsg closed 11 years ago
Hi,
For point (1), I think your solution is probably the correct way to go. It seems to me that setting the ID of an object is actually quite a rare thing (I assume you're using some sort of UUID source to generate IDs rather than letting the database deal with it?)
Point (2) looks like a good idea, I'll add it to my todo list.
For (1) - reason is quite simple really - I often have to create several new model objects, linked through many-to-many table (having some additional attributes), and save all them in a single transaction - so, row IDs are generated by database for rows of data tables, but I set them manually to create link object.
The develop
branches of both Paris and Idiorm now have an is_dirty
method. Would you mind giving these a try?
Cheers
Hi, J4mie - is_dirty() worked for me - thanks!
This looks like it has be resolved. With regard point one this is something that could easily be implemented on per project basis with a class abstract.
Hi, J4mie!
After some time back to my IdiORM-izing and Paris-ing code, I found two things to be useful:
(1) setId() instance method for Model (helpful if working with legacy database, with quite randomly named primary key columns): this one cannot be implemented in clean way by extending Model class as Model::orm->_get_id_column_name() is protected, so I ended up with:
(2) method(-s) to check, whether given field or any fields of Model object are dirty (changed by set())
Thanks for the good job!