[Solved] Convert sql to dql symfony [closed]

[ad_1] 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 … Read more

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

[ad_1] 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: … Read more

[Solved] Mixing PHP frameworks [closed]

[ad_1] 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 … Read more

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

[ad_1] 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

[ad_1] 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 … Read more

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

[ad_1] 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]); } [ad_2] solved How can I get access to service variables?

[Solved] Doctrine Entities Relations confusing

[ad_1] 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 … Read more