0

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

Mbengchan
  • 166
  • 3
  • 17

1 Answers1

0

I have solves this issue.
Everything is working fine now, just that I am using linux so I accidentally created 2 profile.php like Profile.php and profile.
It was causing proplems because in linux Profile.php and profile.php different due to capitalization. So when I browse /profile the server was confused and choose to serve me the php page with capital P. So I'd rename the file and everything is ok now!

felipsmartins
  • 13,269
  • 4
  • 48
  • 56
Mbengchan
  • 166
  • 3
  • 17