Idea for NotORM named queries
<?php | |
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)->... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Reakce na: http://php.vrana.cz/notorm-2.php#d-13092