public function findByTerm($term) { $dumper = new VarDumper(); $q = $this->getEntityManager()->createQuery('SELECT a FROM BeluhaBlogBundle:AuthorQuote a WHERE a.name LIKE :name')->setParameter('name', '%' . $term . '%'); $dumper->dump($q); return $q->getResult(); /*return $this->getEntityManager() ->createQuery('SELECT a FROM BeluhaBlogBundle:AuthorQuote a WHERE a.name LIKE :name') ->setParameter('name', $term.'%') ->getResult();*/ }
/** * Get a list of author for autocomplete. * * @Route("/authorquote_get_authors", name="authorquote_get_authors") */ public function getAuthorQute(Request $request) { $term = $request->query->get('term', null); $em = $this->getDoctrine()->getManager(); $dumper = new VarDumper(); $dumper->dump($term); $authors = $em->getRepository('BeluhaBlogBundle:AuthorQuote')->findByTerm($term); //$dumper->dump($authors); $results = []; foreach ($authors as $author) { $results[] = ['id' => $author->getId(), 'name' => $author->getName(), 'label' => $author->getName()]; } return new JsonResponse($results); }
/** * List quote. * * @Route("/", name="authorquote_quote_index") * @Method("GET") */ public function indexAction(Request $request) { $em = $this->getDoctrine()->getManager(); $dumer = new VarDumper(); //$quotes = $em->getRepository('BeluhaBlogBundle:Quote')->findAll(); $dql = "SELECT q, a FROM BeluhaBlogBundle:Quote q JOIN q.author a"; $query = $em->createQuery($dql); $paginator = $this->get('knp_paginator'); $pagination = $paginator->paginate($query, $request->query->getInt('page', 1), 5); $dumer->dump($pagination); //return $this->render('quote/index.html.twig', array( // 'quotes' => $quotes, //)); return $this->render('quote/index.html.twig', array('pagination' => $pagination)); }
/** * Output pretty-printed arrays / objects. * * @param mixed $var * @param boolean $safe * * @return string */ public function printDump($var, $safe) { if ($safe || !$this->app['debug']) { return null; } return VarDumper::dump($var); }
/** * @param mixed $var */ function appendLog($var) { static $handler = null; if ($handler === null) { $logDir = LOG_DIR; assert(is_dir($logDir), 'log dir "' . $logDir . '" must be a dir'); $logDir .= '/' . date('Ymd'); if (!is_dir($logDir)) { $success = mkdir($logDir); assert($success, 'log dir create failed: ' . $logDir . ': ' . json_encode(error_get_last())); } $logFile = $logDir . '/' . GAME_VERSION; $cloner = new VarCloner(); $dumper = new CliDumper($logFile); $handler = function ($var) use($cloner, $dumper) { $dumper->dump($cloner->cloneVar($var)); }; } $origHandler = VarDumper::setHandler($handler); VarDumper::dump(date('c')); foreach (func_get_args() as $var) { VarDumper::dump($var); } VarDumper::setHandler($origHandler); }
/** * Output pretty-printed backtrace. * * @param integer $depth * @param boolean $safe * * @return string|null */ public function printBacktrace($depth, $safe) { if (!$this->allowDebug($safe)) { return null; } return VarDumper::dump(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, $depth)); }
/** * {@inheritdoc} */ protected function send(Event $event) : bool { $handler = VarDumper::setHandler(); dump($event->format()); VarDumper::setHandler($handler); return true; }
/** * {@inheritdoc} */ public function register(Application $app) { $app['dump'] = $app->protect(function ($var) use($app) { if (!$app['debug']) { return; } $app['dumper']->dump($app['dumper.cloner']->cloneVar($var)); }); VarDumper::setHandler(function ($var) use($app) { /* * Referencing $app['dump'] in anonymous function * so the closure can be replaced in $app without * breaking the reference here. */ return $app['dump']($var); }); $app['dumper'] = $app->share(function ($app) { return PHP_SAPI === 'cli' ? $app['dumper.cli'] : $app['dumper.html']; }); $app['dumper.cli'] = $app->share(function () { return new CliDumper(); }); $app['dumper.html'] = $app->share(function () { return new HtmlDumper(); }); $app['dumper.cloner'] = $app->share(function () { $cloner = new VarCloner(); $cloner->addCasters(Caster\FilesystemCasters::getCasters()); return $cloner; }); }
/** * @dataProvider getDumpTags */ public function testDumpTag($template, $debug, $expectedOutput, $expectedDumped) { $extension = new DumpExtension(new VarCloner()); $twig = new \Twig_Environment(new \Twig_Loader_String(), array( 'debug' => $debug, 'cache' => false, 'optimizations' => 0, )); $twig->addExtension($extension); $dumped = null; $exception = null; $prevDumper = VarDumper::setHandler(function ($var) use (&$dumped) {$dumped = $var;}); try { $this->assertEquals($expectedOutput, $twig->render($template)); } catch (\Exception $exception) { } VarDumper::setHandler($prevDumper); if (null !== $exception) { throw $exception; } $this->assertSame($expectedDumped, $dumped); }
public function configure() { $cloner = $this->cloner; $dumper = $this->dumper; VarDumper::setHandler(function ($var) use($cloner, $dumper) { $dumper->dump($cloner->cloneVar($var)); }); }
public function boot(Application $app) { VarDumper::setHandler(function ($var) { $cloner = new VarCloner(); $dumper = 'cli' === PHP_SAPI ? new CliDumper() : new HtmlDumper(); $dumper->dump($cloner->cloneVar($var)); }); }
public function __construct($workingPath) { $this->setWorkingPath($workingPath); if (is_dir($this->getWorkingPath())) { VarDumper::dump(Finder::create()->in($this->getWorkingPath())->directories()->count()); VarDumper::dump(Finder::create()->in($this->getWorkingPath())->files()->count()); } }
public function symfony($v, $stop = false) { echo '<pre style="' . $this->getStyle() . '">'; SymfonyVarDumper::dump($v); echo '</pre>'; if ($stop) { exit; } }
/** * @Route("/", name="homepage") */ public function indexAction(Request $request) { /* @var $repo EntityRepository */ $repo = $this->getDoctrine()->getManager()->getRepository('AppBundle:Page'); $pages = $repo->findAll(); VarDumper::dump($pages[0]); // replace this example code with whatever you need return $this->render('default/index.html.twig', array('base_dir' => realpath($this->container->getParameter('kernel.root_dir') . '/..'), 'pages' => $pages)); }
public function boot(Application $app) { // This code is here to lazy load the dump stack. This default // configuration for CLI mode is overridden in HTTP mode on // 'kernel.request' event VarDumper::setHandler(function ($var) use($app) { $dumper = new CliDumper(); $dumper->dump($app['var_dumper.cloner']->cloneVar($var)); }); }
protected function execute(InputInterface $input, OutputInterface $output) { $data = $this->extractRouteNumbers(); foreach ($data['day'] as $dayBus) { $busRoute = new BusRoute(); $busRoute->setNumber($dayBus); $busRoute->setNightBus(false); } VarDumper::dump($data); return 0; }
/** * 返回变量的打印html * * // 可以打印多个变量 * echo self::vars($foo, $bar, $baz); * * @return string */ public static function vars() { if (func_num_args() === 0) { return null; } $variables = func_get_args(); $output = []; foreach ($variables as $var) { $output[] = VarDumper::dump($var); } return implode("\n", $output); }
public function boot(Application $app) { if (!$app['debug']) { return; } // This code is here to lazy load the dump stack. This default // configuration for CLI mode is overridden in HTTP mode on // 'kernel.request' event VarDumper::setHandler(function ($var) use($app) { VarDumper::setHandler($handler = function ($var) use($app) { $app['var_dumper.cli_dumper']->dump($app['var_dumper.cloner']->cloneVar($var)); }); $handler($var); }); }
public function configure() { if ($this->container) { $container = $this->container; $dumper = $this->dumper; $this->container = null; VarDumper::setHandler(function ($var) use($container, $dumper) { $dumper = $container->get($dumper); $cloner = $container->get('var_dumper.cloner'); $handler = function ($var) use($dumper, $cloner) { $dumper->dump($cloner->cloneVar($var)); }; VarDumper::setHandler($handler); $handler($var); }); } }
public function boot() { if ($this->container->getParameter('kernel.debug')) { $container = $this->container; // This code is here to lazy load the dump stack. This default // configuration for CLI mode is overridden in HTTP mode on // 'kernel.request' event VarDumper::setHandler(function ($var) use($container) { $dumper = new CliDumper(); $cloner = $container->get('var_dumper.cloner'); $handler = function ($var) use($dumper, $cloner) { $dumper->dump($cloner->cloneVar($var)); }; VarDumper::setHandler($handler); $handler($var); }); } }
/** * @param mixed $vars */ function systrace(...$vars) { openlog('php-debug', LOG_PID, LOG_USER); $cloner = new VarCloner(); $dumper = new \Symfony\Component\VarDumper\Dumper\CliDumper(); $dumper::$defaultColors = true; $handler = function ($var) use($cloner, $dumper) { $dumper->dump($cloner->cloneVar($var), function ($line, $depth, $indentPad) { syslog(LOG_DEBUG, str_repeat($indentPad, $depth < 0 ? 0 : $depth) . $line); }); }; $prevHandler = VarDumper::setHandler($handler); if (sizeof($vars) == 1) { VarDumper::dump($vars[0]); } else { VarDumper::dump($vars); } VarDumper::setHandler($prevHandler); closelog(); }
/** * {@inheritdoc} */ public function register(Application $app) { $app['dump'] = $app->protect(function ($var) use($app) { $app['dumper']->dump($app['dumper.cloner']->cloneVar($var)); }); VarDumper::setHandler($app['dump']); $app['dumper'] = $app->share(function ($app) { return PHP_SAPI === 'cli' ? $app['dumper.cli'] : $app['dumper.html']; }); $app['dumper.cli'] = $app->share(function () { return new CliDumper(); }); $app['dumper.html'] = $app->share(function () { return new HtmlDumper(); }); $app['dumper.cloner'] = $app->share(function () { $cloner = new VarCloner(); $cloner->addCasters(Caster\FilesystemCasters::getCasters()); return $cloner; }); }
public function testConfigure() { $prevDumper = VarDumper::setHandler('var_dump'); VarDumper::setHandler($prevDumper); $cloner = new MockCloner(); $dumper = new MockDumper(); ob_start(); $exception = null; $listener = new DumpListener($cloner, $dumper); try { $listener->configure(); VarDumper::dump('foo'); VarDumper::dump('bar'); $this->assertSame('+foo-+bar-', ob_get_clean()); } catch (\Exception $exception) { } VarDumper::setHandler($prevDumper); if (null !== $exception) { throw $exception; } }
/** * Override Symfony's default handler to get the output */ protected function stubVarDumper() { VarDumper::setHandler(function ($var) { return $var; }); }
/** * Output pretty-printed backtrace. * * @param int $depth * * @return string|null */ public function printBacktrace($depth = 15) { if ($this->safe || !$this->app['debug']) { return null; } return VarDumper::dump(debug_backtrace()); }
function dump($var) { foreach (func_get_args() as $var) { \Symfony\Component\VarDumper\VarDumper::dump($var); } }
public function testTurler() { $client = new \SistemApi\ApiClient('X-IFSISTEM-TOKEN', 'http://ifsistem.app/api/v1'); $haberler = $client->haber->liste((new \SistemApi\Model\Ayar\HaberListeAyar())->setOrderByYayinBaslangicZamani()->setAdet(4)); \Symfony\Component\VarDumper\VarDumper::dump($haberler); }
/** * CLI output of the debug backtrace * * @author Art <*****@*****.**> * * @param array $trace The debug backtrace * @param string $label Colour id * * @codeCoverageIgnore */ private function traceCLI(array $trace, $label) { foreach ($trace as $k => $v) { $func = $loc = $line = ''; $argsPresent = isset($v['args']) && !empty($v['args']); self::formatTraceLine($v, $func, $loc, $line); $this->console->write('<' . $label . 'b>#' . $k . ': </>')->write('<' . $label . '>' . ($loc ? $loc : '<<unknown file>>') . '</> ')->write('<' . $label . '>(' . ($line ? 'line ' . $line : 'unknown line') . ')</>')->write('<' . $label . '> | </>')->write('<' . $label . '>' . $func . '</>', true); if ($argsPresent) { $this->console->write('<' . $label . 'b>Arguments:</>', true); VarDumper::dump($v['args']); } $this->console->writeln(''); } }
function dd($var) { VarDumper::dump($var); }
/** * @author Nicolas Grekas <*****@*****.**> */ function dump($var) { foreach (func_get_args() as $var) { VarDumper::dump($var); } }