Co to jest:
<?php $this->blah()->smash(); ?>
a moze powinno byc:
<?php $this->blah()->$this->smash(); ?>
Jak to sie nazywa, bo nawet chcac w google znalezc nie wiem czego szukac

<?php $query = Doctrine_Query::create() ->from('User u') ->leftJoin('u.Group g') ->orderby('u.username ASC'); // ... ?>
<?php class foo { public function bar() { return $this; } public function one() { return $this; } public function two() { return $this; } } $x = new foo; $x->bar()->one()->two(); ?>
<?php $query = $queryGen->select('column')->form('table'); ?>
<?php class queryGenerator { private $actQuery=''; public function makeQuery() { $actQuery = $this->actQuery; $this->actQuery = ''; return $actQuery; } public function select($select) { $this->actQuery .= 'SELECT '.$select; return $this; } //itd itd } ?>
<?php $queryGen = new queryGenerator(); $query = $queryGen->select('column')->from('table')->makeQuery(); ?>
<? abstract class Db_Table { protected $_Name = null; private $__Db; public function __construct($sConnectionName = null, $sDbConfig = 'database') { if ($this->_Name == null) throw new exception ('Db_Table did not get table name, set $this->_Name'); $oConfig = new Config_Php($sDbConfig); if ($sConnectionName) $aConfig = $oConfig->$sConnectionName; else $aConfig = $oConfig-> { $oConfig->set_default_connection }; $this->__Db = new mysqli ($aConfig['host'], $aConfig['user'], $aConfig['password'], $aConfig['database']); } public function get($mFields = true) { $sFields = $mFields; $sFields = '*'; return $this; } public function execute($sQuery = null) { if ($sQuery == null) $sQuery = $this->_sQuery; $this->_rQuery = $this->__Db->query( $sQuery ); return $this; } public function fetchAll() { $rResult = $this->_rQuery; while ($aRow = $rResult->fetch_assoc()) $aRows [] = $aRow; return $aRows; } public function fetchOne() { $aRow = $this->fetchAll(); return $aRow[0]; } { return $this; } public function where($sClause) { $this->_sQuery .= ' WHERE '.$sClause; return $this; } public function limit($iOffset, $iMax) { $this->_sQuery .= ' LIMIT '.$iOffset.','.$iMax; return $this; } public function group($sWhat) { $this->_sQuery .= ' GROUP BY '.$sWhat; return $this; } public function like($sWhat, $sLike) { $this->_sQuery .= ' WHERE '.$sWhat.' LIKE '%'.$sLike.'%''; return $this; } public function order($sWhat, $sOrder = 'ASC') { $this->_sQuery .= ' ORDER BY '.$sWhat.' '.$sOrder; return $this; } public function insert($aArray) { $this->_sQuery = 'INSERT INTO '.$this->_Name.' ('.$aKeys.') VALUES ("'.$aValues.'")'; return $this; } /* Displays the Query */ public function query() { return $this->_sQuery; } } ?>