示例#1
0
 /**
  * Example of an invokable class, i.e. a class that has an __invoke() method.
  *
  * @see http://php.net/manual/en/language.oop5.magic.php#object.invoke
  */
 public function __invoke()
 {
     echo $this->twig->render('home.twig', ['articles' => $this->repository->getArticles()]);
 }
示例#2
0
 public function __invoke($id, OutputInterface $output)
 {
     $article = $this->repository->getArticle($id);
     $output->writeln('<info>' . $article->getTitle() . '</info>');
     $output->writeln($article->getContent());
 }
示例#3
0
 public function show($id)
 {
     $article = $this->repository->getArticle($id);
     echo $this->twig->render('article.twig', ['article' => $article]);
 }