[Solved] Convert sql to dql symfony [closed]

I assume that you’re within the context of a repository, so in which case I’d advise using the Doctrine Query Builder, it’d help simplify your code flow, and probably would help you with SQL conversions in the future. To answer this specific problem, you’d probably want to do something like the following: public function findSaveByPagesByFilters() … Read more

[Solved] Internal Erro 500 when using class in symfony 3

As per comment, Symfony 3 uses either PSR-0 or PSR-4. Assuming that you’re using Composer, you configure which one to support in your composer.json file. With PSR-4, your filenames must correspond to your class names, and your directory names must match your namespaces. So if your entity is called FloydWarshall in the namespace AppBundle\Entity: it … Read more

[Solved] Mixing PHP frameworks [closed]

It is possible to mix Symfony Standard Edition with any other framework. It is not recommended, but it is possible. The most common situations when you need to do this is when you migrate your old code to Symfony and when you want a blogging system to handle the blogging part of your website (like … Read more

[Solved] Websocket communication in a symfony project [closed]

In the past I tried to use the Wrench library, which has a Symfony bundle : https://github.com/varspool/WebsocketBundle This is a wrapper for the Wrench library, which allows you to create websocket applications. It seems to be quite simple to configure : # app/config/config.yml varspool_websocket: servers: default: # Server name listen: ws://192.168.1.103:8000 # default: ws://localhost:8000 # … Read more

[Solved] Symfony sub domain routing

This solution will intercept the REQUEST_URI and add the subdomain as a root folder if not already used. Meaning app.example.com and app.example.com/app will both access the same page. if(substr($_SERVER[‘HTTP_HOST’], 0, strlen(‘app.’)) === ‘app.’ && substr($_SERVER[‘REQUEST_URI’], 0, strlen(‘/app’)) !== ‘/app’) { $_SERVER[‘REQUEST_URI’] = ‘/app’.$_SERVER[‘REQUEST_URI’]; } The benefit of this is being able to put all your … Read more

[Solved] How can I get access to service variables?

public function pages($slug, PagesGenerator $pagesGenerator) { $output = $pagesGenerator->getPages($slug); // here is your error: $page is not defined. $id = $page->getId(); // something like this? $id = $output[‘page’]->getId(); return $this->render(‘list.html.twig’, [ ‘output’ => $output, ‘id’ => $id]); } solved How can I get access to service variables?

[Solved] Why do we need specific classes to work with Request and Response?

As mentioned here : The Request class is an object-oriented representation of the HTTP request message. With it, you have all the request information at your fingertips and As a bonus, the Request class does a lot of work in the background that you’ll never need to worry about. For example, the isSecure() method checks … Read more

[Solved] Doctrine Entities Relations confusing

The classes can be created like my example below. I based this on @rafix ‘s answer, but there were some problems. Also, you don’t have to name your classes in the singular like @rafix indicated, you can name them however you want. But, it’s much better practive to do it that way and make your … Read more