Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to query another entity in entity class in symfony2 using doctrine
    primarykey
    data
    text
    <p>I'm trying to query using entity manager in a entity class file but I'm getting this error: </p> <pre><code>FatalErrorException: Error: Call to undefined method Acme\MasoudBundle\Entity\User::getDoctrine() in /var/www/test/src/Acme/MasoudBundle/Entity/User.php line 192 </code></pre> <p>my entity class is :</p> <pre><code>namespace Acme\MasoudBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Security\Core\User\AdvancedUserInterface; /** * User * * @ORM\Table(name="user") * @ORM\Entity */ class User implements AdvancedUserInterface, \Serializable { /** * Set email * * @param string $email * @return User */ public function setEmail($email) { $this-&gt;email = $email; return $this; } /** * Get email * * @return string */ public function getEmail() { return $this-&gt;email; } /** * Set isActive * * @param boolean $isActive * @return User */ public function setIsActive($isActive) { $this-&gt;isActive = $isActive; return $this; } /** * Get isActive * * @return boolean */ public function getIsActive() { return $this-&gt;isActive; } /** * @inheritDoc */ public function getRoles() { $em = $this-&gt;getDoctrine()-&gt;getManager(); $Permission= $em-&gt;getRepository('MasoudBundle:Permission')-&gt;find(1); $this-&gt;permissions[]=$Permission-&gt;permission; return $this-&gt;permissions; } } </code></pre> <p>I want to have a permission and authentication system like this, can you help me please? there are 5 tables, a user table, a group table, a permission table, and a group_permission and a user_group table. so After user logins, I want to check which user is for which group, and get the groups permission. how can I do that? please help me as much as you have time.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload