Symfony 3.4 Use view inside my bundle

The basic problem appears to be that in S3.4, twig template paths such as ‘ListerListerBundle:Default:index.html.twig’ are no longer supported. Replace the path in the controller with: ‘@ListerLister/Default/index.html.twig’ And all should be well. If you are ever not sure what the actual namespace prefix is then run: bin/console debug:twig to list them. S3.3 still works fine … Read more

FOS bundle – How to select users with a specific role?

Just add this in your UserRepository or replace $this->_entityName by YourUserBundle:User: /** * @param string $role * * @return array */ public function findByRole($role) { $qb = $this->_em->createQueryBuilder(); $qb->select(‘u’) ->from($this->_entityName, ‘u’) ->where(‘u.roles LIKE :roles’) ->setParameter(‘roles’, ‘%”‘.$role.'”%’); return $qb->getQuery()->getResult(); } If you are using FOSUser Groups you should use: /** * @param string $role * * … Read more

Symfony2 – Force file download

The most comfortable solution is use Symfony\Component\HttpFoundation\BinaryFileResponse; use Symfony\Component\HttpFoundation\ResponseHeaderBag; $response = new BinaryFileResponse($file); $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT); return $response;

Path of assets in CSS files in Symfony 2

I have came across the very-very-same problem. In short: Willing to have original CSS in an “internal” dir (Resources/assets/css/a.css) Willing to have the images in the “public” dir (Resources/public/images/devil.png) Willing that twig takes that CSS, recompiles it into web/css/a.css and make it point the image in /web/bundles/mynicebundle/images/devil.png I have made a test with ALL possible … Read more

Docker in MacOs is very slow

As a matter of fact, Docker needs a plain Linux kernel to run. Unfortunately, Mac OS and Windows cannot provide this. Therefore, there is a client on Mac OS to run Docker. In addition to this, there is an abstraction layer between Mac OS kernel and applications (Docker containers) and the filesystems are not the … Read more