MoroGasper / gii-template-collection

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

Incompatibility with PHP 5.2 #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
There's a call to the PHP function get_called_class() in
ApplicationController.php line 21
http://code.google.com/p/gii-template-collection/source/browse/trunk/gtc/vendors
/ApplicationController.php#21

This function is PHP 5.3 only.
http://php.net/get_called_class

But there's an easy fix: this function will only be called if
ApplicationController::loadModel is called without the controller
name passed to it via the $model parameter.
Simply adding the parameter to the call in the controller class will
solve the problem.

We can solve the problem by overriding ApplicationController::loadModel
in each controller, like (for an UserController loading the User model):
public function loadModel($model=false) {
    return parent::loadModel($model===false?'User':$model);
}

Or by calling ApplicationController::loadModel each time with the model
parameter defined (not the best option, I think).

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

GoogleCodeExporter commented 8 years ago
Please check also the enhancement proposed in issue 9.

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

GoogleCodeExporter commented 8 years ago
Attached a patch to fix the issue.

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

Attachments:

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r89.

Original comment by robregonm on 3 Sep 2010 at 3:48