Skip to content

Instantly share code, notes, and snippets.

@mlebkowski
Created February 20, 2015 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlebkowski/d406de54f8bef3a4ada0 to your computer and use it in GitHub Desktop.
Save mlebkowski/d406de54f8bef3a4ada0 to your computer and use it in GitHub Desktop.
<?php
class QueryDependent
{
/**
* @var Callable
*/
private $queryFactory;
public function __construct(ModelCriteria $query)
{
$this->queryFactory = function () use ($query) { return clone $query; };
}
/**
* @return ModelCriteria
*/
private function getQuery()
{
return call_user_func($this->queryFactory);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment