PropriedadeSoftwareRepository.php 1.17 KB
<?php

namespace Cacic\CommonBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * PropriedadeSoftwareRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class PropriedadeSoftwareRepository extends EntityRepository
{

    /**
     * Retorna lista de todas as propriedades coletadas
     *
     * @return mixed
     */

    public function propPorNome( $nmSoftware ) {
        $qb = $this->createQueryBuilder('prop')
            ->select('prop')
            ->innerJoin('CacicCommonBundle:Software', 'sw', 'WITH', 'sw.idSoftware = prop.software')
            ->andWhere('sw.nmSoftware = :nmSoftware')
            ->setParameter('nmSoftware', $nmSoftware);

        return $qb->getQuery()->execute();
    }


    public function softwareByName( $nmSoftware ) {
        $qb = $this->createQueryBuilder('prop')
            ->select('prop')
            ->innerJoin('CacicCommonBundle:classProperty', 'cp', 'WITH', 'prop.classProperty = cp.idClassProperty')
            ->andWhere('cp.nmPropertyName = :nmSoftware')
            ->setParameter('nmSoftware', $nmSoftware);

        return $qb->getQuery()->getOneOrNullResult();
    }

}