Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace AppBundleRepository;
- use AppBundleEntityDomini;
- use DoctrineORMEntityRepository;
- class DominiRepository extends DoctrineORMEntityRepository
- {
- /**
- * @return dominio[]
- */
- public function findAllPublishedOrderedBySize()
- {
- $query = 'SELECT dominio FROM AppBundle:Domini dominio';
- $mydomain = $this->getEntityManager()->createQuery($query);
- return $mydomain->execute();
- }
- }
- <?php
- // src/AppBundle/Controller/DominiController.php
- namespace AppBundleController;
- use AppBundleEntityDomini;
- use SensioBundleFrameworkExtraBundleConfigurationMethod;
- use SensioBundleFrameworkExtraBundleConfigurationRoute;
- use SymfonyComponentHttpFoundationResponse;
- use SymfonyBundleFrameworkBundleControllerController;
- use DoctrineORMEntityManagerInterface;
- class DominiController extends Controller
- {
- /**
- * @Route("/admin/domini")
- */
- public function dominiAction()
- {
- $title = "ADMIN";
- $nome_utente = $this->getUser();
- $user = $this->getUser()->getId();
- $em = $this->getDoctrine()->getManager();
- $dominilist = $em->getRepository('AppBundle:Domini')
- ->findAllPublishedOrderedBySize();
- return $this->render('admin/domini.html.twig', [
- 'title' => $title,
- 'nome_utente' => $nome_utente,
- 'user' => $user,
- 'dominilist' => $dominilist,
- ]);
- }
- }
- <h1>{{ title }}</h1>
- <h2>Benvenuto: {{ nome_utente }}</h2>
- <h3>USER ID:{{ user }}</h3>
- <ul>
- {% for item in dominilist %}
- <li>{{ item.dominio }}</li>
- {% endfor %}
- </ul>
Advertisement
Add Comment
Please, Sign In to add comment