Hi there-

The Doctrine annotations (including @Entity) must be prefixed "ORM\":
http://symfony.com/doc/current/book/doctrine.html#custom-repository-classes

Thanks!

Ryan Weaver
US Office Head & Trainer - KnpLabs - Nashville, TN
http://www.knplabs.com <http://www.knplabs.com/en>
http://www.thatsquality.com
Twitter: @weaverryan


On Sat, Jun 4, 2011 at 7:17 PM, agomez <agomezmen...@gmail.com> wrote:

> 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 symfony-devs@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-devs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-devs?hl=en
>

-- 
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 symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to