Chapter 7;need help

In chapter 7,page 165,Changing the authenticate implementation,

the given code extracts username & password from a table User.


but in my app,i have my users in two tables,called lawyer & client.

So i have username,password attributes in both tables.

I want to use both of these tables to be searched,when a user is trying to login.

I tried to do it like this.but it doesn’t work.

$user=(Lawyer::model()->findByAttributes(array('userName'=>$this->username)))|| $user=(Client::model()->findByAttributes(array('userName'=>$this->username))) ;

this is what i get when tried with above code snippet.

PHP Error : Trying to get property of non-object.

	Any help please,


thats really wrong way to do it. imagine if your user base type grows, you’ll have to have table for judge, policeman, guards, etc

what you need is single user table and in it you can have a field called type, to this field you can assign a number





you get the point ;) Its really wrong to split it like that and use both tables to log in, its not standard practice! :)