public function findByEmployee($userOrId)
    {
        $userId = $userOrId instanceof \Auth\Entity\UserInterface ? $userOrId->getId() : $userOrId;

        /*
         * Employees collection is only set on main organization,
         * so here, we do not have to query the "parent" field.
         *
         * Only search for "assigned" employees.
         */
        $entity = $this->findOneBy(
            array(
            'employees.user' => new \MongoId($userId),
            'employees.status' => EmployeeInterface::STATUS_ASSIGNED
            )
        );

        return $entity;
    }
public function findByEmployee($userOrId)
    {
        $userId = $userOrId instanceof \Auth\Entity\UserInterface ? $userOrId->getId() : $userOrId;

        /*
         * Employees collection is only set on main organization,
         * so here, we do not have to query the "parent" field.
         *
         * Only search for "assigned" employees.
         */
        $entity = $this->findOneBy(
            array(
            'employees.user' => new \MongoId($userId),
            'employees.status' => EmployeeInterface::STATUS_ASSIGNED
            )
        );

        return $entity;
    }
public function findByEmployee ( $ userOrId ) { $ userId = $ userOrId instanceof \ Auth \ Entity \ UserInterface ? $ userOrId -> getId ( ) : $ userOrId ; /*
         * Employees collection is only set on main organization,
         * so here, we do not have to query the "parent" field.
         *
         * Only search for "assigned" employees.
         */ $ entity = $ this -> findOneBy ( array ( 'employees.user' => new \ MongoId ( $ userId ) , 'employees.status' => EmployeeInterface :: STATUS_ASSIGNED ) ) ; return $ entity ; }
Finds the organization, an user is employed by.

@param string|UserInterface $userOrId

@return null|OrganizationInterface
Finds the organization an user is employed by .