whenever i insert a entity that already exists in database (i have a unique constraint on email) i get an error message on the screen.
so i want to check if it already exists, if not i insert it.
at the moment it looks like this:
$q = Doctrine_Query::create()
->from('User u')
->where('u.email = ?', $email);
$object = $q->fetchOne();
if( ! is_object($object)) {
$user = new User();
$user-email = $email;
$user->save();
}
i wonder, if there an easier way to do this?
thanks