public function getSite($nb_site)
    {
        $retval = false;

        if (is_object($nb_site) && !($nb_site instanceof CNabuDataObject)) {
            throw new ENabuCoreException(
                ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
                array('$nb_site', get_class($nb_site))
            );
        }

        if ($nb_site !== null) {
            $nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID);
            if (is_numeric($nb_site_id) || nb_isValidGUID($nb_site_id)) {
                $retval = $this->nb_site_list->getItem($nb_site_id);
                if ($retval instanceof CNabuSite) {
                    if (!$retval->validateCustomer($this)) {
                        $this->nb_site_list->removeItem($retval);
                        $retval = false;
                    } else {
                        $retval->setCustomer($this);
                    }
                }
            } elseif ($nb_site_id !== null && $nb_site_id !== false) {
                throw new ENabuCoreException(
                    ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
                    array('$nb_site', print_r($nb_site, true))
                );
            }
        }

        return $retval;
    }
public function getSite($nb_site)
    {
        $retval = false;

        if (is_object($nb_site) && !($nb_site instanceof CNabuDataObject)) {
            throw new ENabuCoreException(
                ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
                array('$nb_site', get_class($nb_site))
            );
        }

        if ($nb_site !== null) {
            $nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID);
            if (is_numeric($nb_site_id) || nb_isValidGUID($nb_site_id)) {
                $retval = $this->nb_site_list->getItem($nb_site_id);
                if ($retval instanceof CNabuSite) {
                    if (!$retval->validateCustomer($this)) {
                        $this->nb_site_list->removeItem($retval);
                        $retval = false;
                    } else {
                        $retval->setCustomer($this);
                    }
                }
            } elseif ($nb_site_id !== null && $nb_site_id !== false) {
                throw new ENabuCoreException(
                    ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
                    array('$nb_site', print_r($nb_site, true))
                );
            }
        }

        return $retval;
    }
public function getSite ( $ nb_site ) { $ retval = false ; if ( is_object ( $ nb_site ) && ! ( $ nb_site instanceof CNabuDataObject ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_CLASS_TYPE , array ( '$nb_site' , get_class ( $ nb_site ) ) ) ; } if ( $ nb_site !== null ) { $ nb_site_id = nb_getMixedValue ( $ nb_site , NABU_SITE_FIELD_ID ) ; if ( is_numeric ( $ nb_site_id ) || nb_isValidGUID ( $ nb_site_id ) ) { $ retval = $ this -> nb_site_list -> getItem ( $ nb_site_id ) ; if ( $ retval instanceof CNabuSite ) { if ( ! $ retval -> validateCustomer ( $ this ) ) { $ this -> nb_site_list -> removeItem ( $ retval ) ; $ retval = false ; } else { $ retval -> setCustomer ( $ this ) ; } } } elseif ( $ nb_site_id !== null && $ nb_site_id !== false ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$nb_site' , print_r ( $ nb_site , true ) ) ) ; } } return $ retval ; }
Gets a Site by their ID.
If the internal Site List contains a instance with same ID returns this instance, else if not exists,
tries to locate it in the storage and, if exists, then load it, add into Site List and returns their
instance as result.
@param mixed $nb_site A CNabuDataObject instance containing a nb_site_id field or an ID.
@return CNabuSite Returns the Site instance if exists or false if not.
@throws ENabuCoreException Raises an exception if $nb_site has no valid value.
Gets a Site by their ID . If the internal Site List contains a instance with same ID returns this instance else if not exists tries to locate it in the storage and if exists then load it add into Site List and returns their instance as result .