Alexander Matrosov Mon Jul 07 02:07:50 -0400 2014

Subject: how to check the existence of a connection

class Guest extends ActiveRecord\Model {

static $table_name = 'guest';
static $belongs_to = array(
array('user')
);
}
// model User.php
public function getLogin(){
return $this->users_login ? $this->users_login : 'no user';
}

//and if you delete the user, but leave him messages
//trying to get the user name through communications
$post->user->getLogin();

//displays an error
Call to a member function getLogin() on a non-object

tell me how to solve this problem