you could do:
if ($this->Driver instanceof Driver && $this->Driver->exists())
{
echo 'exists';
}
On Mon, Jan 5, 2009 at 5:40 PM, juro <[email protected]> wrote:
>
> Hi,
> I have this schema:
>
> Car:
> columns:
> id: integer(4)
> name: string(255)
> relations:
> Driver:
> local: id
> foreign: car_id
>
> Driver:
> columns:
> id: integer(4)
> name: string(255)
> car_id: integer(4)
> relations:
> Car:
> local: car_id
> foreign: id
>
> From inside a Car instance, what is the best practice way to find out,
> whether there is a Driver related to it. I used to to
>
> if ($this->getDriver() != '')
> {
> echo 'this car has no driver';
> }
>
> But I am sure Doctrine has a nicer way to do this ...
>
> juro
> >
>
--
Jonathan H. Wage
Open Source Software Developer & Evangelist
http://www.jwage.com
http://www.doctrine-project.org
http://www.symfony-project.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---