I'm trying to test if a record exists with the following code using PHP Activerecord:
class User extends ActiveRecord\Model {
public function user_exists() {
$user = User::find_by_email($this->email);
if ( $user ) {
return true;
} else {
return false;
}
}
}
$user = new User();
$user->email = "test@email.com";
if ( $user->user_exists() ) {
echo "user exists";
} else {
echo "no user";
}
For some reason, I'm getting a 'Call to undefined method: find_by_email' error. What am I doing wrong?