protected function load()
    {
        if (null !== $this->_type) {
            return;
        }

        // Is the user the owner of the referenced organization?
        $org = $this->_repository->findByUser($this->_userId);

        if ($org) {
            $this->_type = self::TYPE_OWNER;
            $this->_organization = $org;

            return;
        }

        // Is the user employed by the referenced organization?
        $org = $this->_repository->findByEmployee($this->_userId);

        if ($org) {
            $this->_type = self::TYPE_EMPLOYEE;
            $this->_organization = $org;

            return;
        }

        // It seems the user is not associated with an organization.
        $this->_type = self::TYPE_NONE;
    }
protected function load()
    {
        if (null !== $this->_type) {
            return;
        }

        // Is the user the owner of the referenced organization?
        $org = $this->_repository->findByUser($this->_userId);

        if ($org) {
            $this->_type = self::TYPE_OWNER;
            $this->_organization = $org;

            return;
        }

        // Is the user employed by the referenced organization?
        $org = $this->_repository->findByEmployee($this->_userId);

        if ($org) {
            $this->_type = self::TYPE_EMPLOYEE;
            $this->_organization = $org;

            return;
        }

        // It seems the user is not associated with an organization.
        $this->_type = self::TYPE_NONE;
    }
protected function load ( ) { if ( null !== $ this -> _type ) { return ; } // Is the user the owner of the referenced organization? $ org = $ this -> _repository -> findByUser ( $ this -> _userId ) ; if ( $ org ) { $ this -> _type = self :: TYPE_OWNER ; $ this -> _organization = $ org ; return ; } // Is the user employed by the referenced organization? $ org = $ this -> _repository -> findByEmployee ( $ this -> _userId ) ; if ( $ org ) { $ this -> _type = self :: TYPE_EMPLOYEE ; $ this -> _organization = $ org ; return ; } // It seems the user is not associated with an organization. $ this -> _type = self :: TYPE_NONE ; }
Loads the organization from the database and sets the reference type.
Loads the organization from the database and sets the reference type .