What is the problem with the Repository?
Error message:
Entity 'Ed\PortalBundle\Entity\Rol' has no field 'cuentaRoles'. You
can therefore not call 'findByCuentaRoles' on the entities' repository
Entity Rol.php
--------------
<?php
namespace Ed\PortalBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @Entity(repositoryClass="EdPortalBundle\Repository\RolRepository")
*
*/
class Rol
{
/**
* @var integer $rolId
*/
private $rolId;
/**
* @var date $rolFechaExpiracion
RolRepository:
--------------
<?php
namespace Ed\PortalBundle\Repository;
use Doctrine\ORM\EntityRepository;
class RolRepository extends EntityRepository
{
public function findByCuentaRoles($idUsuario)
{
$q = $this->getEntityManager()->createQuery('SELECT SELECT
COUNT(r.rol_id) FROM Ed\PortalBundle\Entity\Rol r where
r.rol_id_usuario=?1');
$q->setParameter(1, $idUsuario);
return $query->getResult(Query::HYDRATE_SINGLE_SCALAR);
}
}
?>
Controller:
-----------
$em = $this->get('doctrine')->getEntityManager();
//Cuenta los perfiles del usuario
$ii_numero_perfil = $em->getRepository('EdPortalBundle:Rol')
->findByCuentaRoles($usuario->getUsuaRut());
if ($ii_numero_perfil == 0) {
Thanks
AG
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
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