src/Model/AbstractMapper.php
public function selectById($id)
	{
		$sql = "SELECT * FROM `$this->tableName` WHERE `$this->pkColName` = %d ";
		$stmt = $this->pdo->prepare(sprintf($sql, $id));
		$res = $stmt->execute();

		if ($res === false) {
			return null;
		}

		$rows = $stmt->fetchAll();

		if (count($rows) !== 1) {
			return null;
		}

		return $this->prepareEntity($rows[0]);
	}
public function selectById($id)
	{
		$sql = "SELECT * FROM `$this->tableName` WHERE `$this->pkColName` = %d ";
		$stmt = $this->pdo->prepare(sprintf($sql, $id));
		$res = $stmt->execute();

		if ($res === false) {
			return null;
		}

		$rows = $stmt->fetchAll();

		if (count($rows) !== 1) {
			return null;
		}

		return $this->prepareEntity($rows[0]);
	}
public function selectById ( $ id ) { $ sql = "SELECT * FROM `$this->tableName` WHERE `$this->pkColName` = %d " ; $ stmt = $ this -> pdo -> prepare ( sprintf ( $ sql , $ id ) ) ; $ res = $ stmt -> execute ( ) ; if ( $ res === false ) { return null ; } $ rows = $ stmt -> fetchAll ( ) ; if ( count ( $ rows ) !== 1 ) { return null ; } return $ this -> prepareEntity ( $ rows [ 0 ] ) ; }
Select entity by its ID.

@param integer $id
@return EntityInterface|null
Select entity by its ID .