public function __construct($id, Pg $pg, $sql, array $options = array()) { $this->pg = $pg; $this->sql = $sql; $resolve = function () { try { // have search_path? if ($searchPath = $this->getSearchPath()) { $this->pg->setParameter('search_path', $searchPath); } // execute sql $output = $this->pg->query(new Raw($this->sql)); // restore search path if appropriate if ($searchPath) { $this->pg->restoreParameter('search_path'); } } catch (\Exception $e) { throw new ResolutionException($this->id, $e); } }; parent::__construct($id, $resolve, $options); }
/** * Resolve a entire assets directory * @return ResolverList */ public function resolveByDirs(array $dirs, ResolverList $assets, ResolverList $resolved) { // apply all obs to the database $resolveByDirs = new DependencyResolver("resolveByDirs-" . json_encode($dirs), function () use($dirs, $assets) { return true; printf("Resolved assets in directories\n%s\n", json_encode($dirs, JSON_PRETTY_PRINT)); }); // add all our resources as the database build setup foreach ($this->getSqlAssetsFromDirs1($dirs) as $file) { // print_r( $file ); $name = substr($file->getBasename(), 0, -4); if ($assets->containsId($name)) { $resolveByDirs->addDependency($assets->getById($name)); } } $resolveByDirs->resolve($resolved, new ResolverList(), true); return $resolved; }
public function __construct($missingDependency, DependencyResolver $resolver, ResolverList $list) { parent::__construct(sprintf("Can't find dependency `%s` for `%s` in passed list %s", $missingDependency, $resolver->getId(), (string) $list)); }