What is the problem?
Error Message:
Entity 'Edudata\PortalBundle\Entity\Rol' has no field 'cuentaRoles'.
You can therefore not call 'findByCuentaRoles' on the entities'
repository
The code:
Entity:
<?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
*/
private $rolFechaExpiracion;
RolRepository.php:
<?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 Edudata\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();
$ii_numero_perfil = $em->getRepository('EdudataPortalBundle:Rol')
-
>findByCuentaRoles($usuario-->getUsuaRut());
if ($ii_numero_perfil == 0) {
$mensaje='El usuario no tiene rol asignado';
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 developers" 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-devs?hl=en