src/Rio/AbstractEntity.php
protected function load()
    {
        if ($this->uid === null) {
            throw new Exception('Entity "'. CamelCase::to($this->table) . '" not initialized');
        }

        $statement = $this->adapter->getDriver()->query(
            sprintf(
                "SELECT t0.* FROM `{$this->table}` AS t0 WHERE t0.`%s` = %s",
                $this->primary,
                $this->adapter->getDriver()->quote($this->uid, $this->properties[$this->primary]['type'])
            )
        );

        $row = $statement->fetchAssoc();

        if (false === is_array($row)) {
            throw new Exception('Entity not found "' . CamelCase::to($this->table) . ' #' . $this->uid . '"');
        }

        return $this->fromArray($row);
    }
protected function load()
    {
        if ($this->uid === null) {
            throw new Exception('Entity "'. CamelCase::to($this->table) . '" not initialized');
        }

        $statement = $this->adapter->getDriver()->query(
            sprintf(
                "SELECT t0.* FROM `{$this->table}` AS t0 WHERE t0.`%s` = %s",
                $this->primary,
                $this->adapter->getDriver()->quote($this->uid, $this->properties[$this->primary]['type'])
            )
        );

        $row = $statement->fetchAssoc();

        if (false === is_array($row)) {
            throw new Exception('Entity not found "' . CamelCase::to($this->table) . ' #' . $this->uid . '"');
        }

        return $this->fromArray($row);
    }
protected function load ( ) { if ( $ this -> uid === null ) { throw new Exception ( 'Entity "' . CamelCase :: to ( $ this -> table ) . '" not initialized' ) ; } $ statement = $ this -> adapter -> getDriver ( ) -> query ( sprintf ( "SELECT t0.* FROM `{$this->table}` AS t0 WHERE t0.`%s` = %s" , $ this -> primary , $ this -> adapter -> getDriver ( ) -> quote ( $ this -> uid , $ this -> properties [ $ this -> primary ] [ 'type' ] ) ) ) ; $ row = $ statement -> fetchAssoc ( ) ; if ( false === is_array ( $ row ) ) { throw new Exception ( 'Entity not found "' . CamelCase :: to ( $ this -> table ) . ' #' . $ this -> uid . '"' ) ; } return $ this -> fromArray ( $ row ) ; }
Load entity by primary key

@throws \Rio\Exception
@return self
Load entity by primary key