This bothered me for quite some time, but now I need to find the answer.
We are working on a fairly large project using CodeIgniter plus Doctrine.
Our application has an interface, as well as an administration area for checking / changing / deleting data.
When we designed the front end, we simply consumed most of the Doctrine code directly in the controller:
function register()
{
$data = get_post_data();
if (count($data) && isValid($data))
{
$U = new User();
$U->fromArray($data);
$U->save();
$C = new Customer();
$C->fromArray($data);
$C->user_id = $U->id;
$C->save();
redirect_to_next_step();
}
}
Obviously, when we went to start duplicating the admin code, and we decided that we were in “get it DONE” mode, so it now stinks with the bloat code.
I have moved a lot of functionality (business logic) into the model using model methods, but basic CRUD is not suitable.
CRUD , Customer:: save ($ array) [ , , prikey ], Customer:: delete ($ id), Customer:: getObj ($ id = false) [ false, ]. , 32 ( ).
, ( ), .
( -), , , - 3 "", CRUD - (), - , ?
.