While upgrading my own module to work with latest Kohana (3.3) I found malfunction in my scenario. I use template driven schema in my app (My Controllers extend Controller_Theme). But for AJAX calls I used in version 3.2 separate Controller which extends just Controller. I had to instantiate Request object in this controller for access passed variables via POST or GET in Rquest object. I did it in __construct() method:
class Controller_Ajax extends Controller {
public function __construct()
{
$this->request = Request::current();
}
public function action_myaction()
{
if($this->is_ajax())
{
$url = $this->request->post('url');
$text = $this->request->post('text');
}
}
}
In myaction() method I can access posted variables like this. But this does not work anymore in Kohana 3.3. I always get this error:
ErrorException [ Fatal Error ]: Call to a member function action() on a non-object
SYSPATH/classes/Kohana/Controller.php [ 73 ]
68 {
69 // Execute the "before action" method
70 $this->before();
71
72 // Determine the action to use
73 $action = 'action_'.$this->request->action();
74
75 // If the action doesn't exist, it's a 404
76 if ( ! method_exists($this, $action))
77 {
78 throw HTTP_Exception::factory(404,
I am sure I have routes set up correctly. I didn't found any changes in migration document from 3.2 to 3.3 about Request object. Or did I missed something?