I have creates created a message controller separately from user profile becuase messages may be present in more than one location and am trying to adhere to the DRY! rule. these is my message controller
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Messages extends Controller
{
public function action_index()
{
URL::redirect();
}
public function action_get_messages()
{
$messages = array(
'This is test message one',
'This is test message two',
'This is test message three'
);
$this->response->body(View::factory('profile/messages')
->set('messages', $messages)
);
}
}
and i requested the controller in my profile controller like so $messages = Request::factory('messages/get_messages')->execute()->response;
these is my full profile controller
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Profile extends Controller_Application {
public function action_index()
{
$content = View::factory('profile/public')
->set('username', 'Test User')
->bind('messages', $messages);
$messages = Request::factory('Messages/get_messages')->execute()->response;
$this->template->content = $content;
}
}
but when i run the code i get these error "ErrorException [ Notice ]: Array to string conversion" what am i doing wrong here guy please help am using Kohana 3.3.3. it use to work with Kohana 3.0 - 3.2