Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Idea for NotORM named queries
namespace My;
class NotORM extends \NotORM
public static function getReflection()
return new Nette\Reflection\ClassType(get_called_class());
public function __call($name, $args)
// extension methods
if ($cb = $this->getReflection()->getExtensionMethod($name)) {
array_unshift($args, $this);
return $cb->invokeArgs($args);
return parent::__call($name, $args);
public function setNamedQuery($name, $query)
$this->getReflection()->setExtensionMethod($name, $query);
$notOrm = new NotORM(...);
$notOrm->setNamedQuery('someQuery', function ($NotORM, $param1, $param2, ...) {
return $NotORM->page('id', $NotORM->page()->select('MAX(id) id')->group('parent, url');
$notOrm->someQuery($param1, $param2)->...

This comment has been minimized.

Copy link
Owner Author

fprochazka commented Feb 27, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.