<?php

namespace Neblion\ScrumBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * FeatureRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class FeatureRepository extends EntityRepository
{
    public function load($id)
    {
        return $this->getEntityManager()
                ->createQuery(
                    'SELECT f, p, s
                    FROM NeblionScrumBundle:Feature f
                    INNER JOIN f.project p
                    INNER JOIN f.stories s
                    WHERE f.id = :id'
                )
                ->setParameter('id', $id)
                ->getOneOrNullResult();
    }
    
    public function getListForProject($project_id, $returnQuery = false)
    {
        $query = $this->getEntityManager()
                ->createQuery(
                    'SELECT f FROM NeblionScrumBundle:Feature f
                    INNER JOIN f.project p
                    WHERE p.id = :project_id
                    ORDER BY f.name'
                )
                ->setParameter('project_id', $project_id);
        if (!$returnQuery) {
            return $query->getArrayResult();
        }
        
        return $query;
    }
    
}
<?php

namespace Neblion\ScrumBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * FeatureRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class FeatureRepository extends EntityRepository
{
    public function load($id)
    {
        return $this->getEntityManager()
                ->createQuery(
                    'SELECT f, p, s
                    FROM NeblionScrumBundle:Feature f
                    INNER JOIN f.project p
                    LEFT JOIN f.stories s
                    WHERE f.id = :id'
                )
                ->setParameter('id', $id)
                ->getOneOrNullResult();
    }
    
    public function getListForProject($project_id, $returnQuery = false)
    {
        $query = $this->getEntityManager()
                ->createQuery(
                    'SELECT f FROM NeblionScrumBundle:Feature f
                    INNER JOIN f.project p
                    WHERE p.id = :project_id
                    ORDER BY f.name'
                )
                ->setParameter('project_id', $project_id);
        if (!$returnQuery) {
            return $query->getArrayResult();
        }
        
        return $query;
    }
    
}
Fix FeatureRepo load left join to stories
Fix FeatureRepo load left join to stories
