Welcome Guest, Not a member yet? Register   Sign In
IgnitedRecord / DataMapper question
#1

[eluser]ryeguy[/eluser]
In either of these libraries, is it possible to update a record WITHOUT first retrieving it?

IE in datamapper, unless I'm mistaken, you must do:
Code:
$u=new User();
$u->get_by_id(3);
$u->username="newusername";
$u->save();

This results in 2 SQL queries even though it could clearly be done in one. Is there a way to do this in either library with only 1 query?
#2

[eluser]m4rw3r[/eluser]
The short answer is no.

But if you serialize a record and store it in session, then you don't need to fetch it again when you modify it and save it.
(but it is recommended to fetch it first, then you're sure that it exists)




Theme © iAndrew 2016 - Forum software by © MyBB