tingobol / gii-template-collection

Automatically exported from code.google.com/p/gii-template-collection
0 stars 0 forks source link

[Enh] loadModel could be more flexible #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I saw that ApplicationController::loadModel uses GET['id'] and this will be the 
values used most of the time.
But the method could be more flexible by adopting an aditional parameter with 
default value. This way, we'll have both the ease to write just
$this->loadModel() and the flexibility to pass a non-default value by
using $this->loadModel(false, $my_real_id).

You could declare the method like this:
public function loadModel($model = false, $id = $GET['id'])

Notice that this would change also the method declaration in my other
suggestion in issue 8.

Original issue reported on code.google.com by rodrigo.coelho@gmail.com on 2 Sep 2010 at 10:05

GoogleCodeExporter commented 9 years ago
Now I realize that using $GET['id'] on the method declaration is not safe:
this could lead to a PHP error if it is not defined. Maybe 'null' is a better
option, then assign $GET['id'] if $id is null and $GET['id'] is set.

Original comment by rodrigo.coelho@gmail.com on 2 Sep 2010 at 10:11

GoogleCodeExporter commented 9 years ago
Hello,
I was thinking about this suggestion, and realized that it is really a corner 
case,
too much application-specific.
Please ignore this ticket.

Original comment by rodrigo.coelho@gmail.com on 2 Sep 2010 at 12:52

GoogleCodeExporter commented 9 years ago
Ok. Ignored.

Original comment by robregonm on 6 Sep 2010 at 3:39