Created
February 20, 2015 12:21
-
-
Save mlebkowski/d406de54f8bef3a4ada0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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