You could use Event Listeners. Read more about them in the doctrine documentation: Event Listeners
In symfony 1.4 sfGuardUser can be modified. It's by default in lib/model/doctrine/sfDoctrineGuardPLugin/sfGuardUser.class.php. You can add following preDqlSelect() method to modify the query. Note that it's not tested.
class sfGuardUser extends PluginsfGuardUser
{
public function preDqlSelect($event)
{
$params = $event->getParams();
$query = $event->getQuery();
$alias = $params['alias'] . '.Profile';
if ((!$query->isSubquery() || ($query->isSubquery() && $query->contains(' ' . $params['alias'] . ' '))) && !$query->contains($alias))
{
$query->innerJoin($alias);
}
}
}
To make it working you need to have DQL callbacks turned on. You can do it in your ProjectConfiguration class:
class ProjectConfiguration extends sfProjectConfiguration
{
public function configureDoctrine(Doctrine_Manager $manager)
{
$manager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
}
}