src/Fw/Model/Query.php
function get_by_id($id, $ammend_query = '')
	{
		if (isset(self::$_cache[$this->_table][$id])) {
			//var_dump(self::$_cache[$this->_table][$id]);
			return self::$_cache[$this->_table][$id];
		}

		$q = \Fw\Db::prepare("select * from " . $this->_table . " where id=? " . $ammend_query);
		$q->execute(array($id));
		$res = $q->fetchObject($this->_entity);
		self::$_cache[$this->_table][$id] = $res;

		return $res;
	}
function get_by_id($id, $ammend_query = '')
	{
		if (isset(self::$_cache[$this->_table][$id])) {
			//var_dump(self::$_cache[$this->_table][$id]);
			return self::$_cache[$this->_table][$id];
		}

		$q = \Fw\Db::prepare("select * from " . $this->_table . " where id=? " . $ammend_query);
		$q->execute(array($id));
		$res = $q->fetchObject($this->_entity);
		self::$_cache[$this->_table][$id] = $res;

		return $res;
	}
function get_by_id ( $ id , $ ammend_query = '' ) { if ( isset ( self :: $ _cache [ $ this -> _table ] [ $ id ] ) ) { //var_dump(self::$_cache[$this->_table][$id]);
 return self :: $ _cache [ $ this -> _table ] [ $ id ] ; } $ q = \ Fw \ Db :: prepare ( "select * from " . $ this -> _table . " where id=? " . $ ammend_query ) ; $ q -> execute ( array ( $ id ) ) ; $ res = $ q -> fetchObject ( $ this -> _entity ) ; self :: $ _cache [ $ this -> _table ] [ $ id ] = $ res ; return $ res ; }
Get by ID Helper. Benefits from caching

@param $id
@param string $ammend_query
@return mixed
Get by ID Helper . Benefits from caching