ErrorException [ Notice ]: Trying to get property 'companyid' of non-object

APPPATH/classes/controller/page.php [ 30 ]

25 
26 	public function action_worksDetail()
27 	{
28 		$slug = $this->request->param("slug");
29 		$this->data->work = R::findOne("works", "slug=?", array($slug));
30 		$this->data->company = R::findOne("company", "id=?", array($this->data->work->companyid) );
31 		$n = $this->data->work->ord + 1;
32 		$p = $this->data->work->ord - 1;
33 
34 		$this->data->next = R::findOne( "works", "ord = ?", array($n) );
35 		$this->data->prev = R::findOne( "works", "ord = ?", array($p) );
  1. APPPATH/classes/controller/page.php [ 30 ] » Kohana_Core::error_handler(arguments)

  2. {PHP internal call} » Controller_Page->action_worksDetail()

  3. SYSPATH/classes/kohana/request/client/internal.php [ 118 ] » ReflectionMethod->invoke(arguments)

  4. SYSPATH/classes/kohana/request/client.php [ 64 ] » Kohana_Request_Client_Internal->execute_request(arguments)

  5. SYSPATH/classes/kohana/request.php [ 1138 ] » Kohana_Request_Client->execute(arguments)

  6. DOCROOT/index.php [ 111 ] » Kohana_Request->execute()

Environment