Category : symfony4

I want to match all paths for a specific host and redirect to a new one: redirect_from_host: path: /{uri}/ host: www.my-old-domain.com defaults: _controller: FrameworkBundle:Redirect:urlRedirect path: https://www.my-new-domain.com permanent: true This works for URL’s like www.my-old-domain.com/foo/ but doesn’t with: www.my-old-domain.com/foo/bar/ So I have to add more routing definitions like: redirect_from_host_2: path: /{uri}/{uri2}/ host: www.my-old-domain.com defaults: _controller: FrameworkBundle:Redirect:urlRedirect ..

Read more

After creating a user I want to make functionality to update email/ canonical email of the other accounts. I’m trying to update using: $user = $this->fosUserManager->findUserBy(["id" => $id]); $user->setEmail($content->email); $this->fosUserManager->updateUser($user); But this is not updating correctly. Is there any other way this can be done. Preferably by using the api platform itself. Thanks and Regards ..

Read more

php bin/console doctrine:database:create [critical] Error thrown while running command "doctrine:database:create". Message: "An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution" In AbstractMySQLDriver.php line 112: An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in n ame resolution In Exception.php line 18: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: ..

Read more

I’m trying to create a reusable bundle and i get Invalid type for path "bayard_directus.authentication.email". Expected "array", but got "string" the TreeBuilder looks like this: $treeBuilder = new TreeBuilder(‘bayard_directus’); $treeBuilder->getRootNode() ->children() ->arrayNode(‘authentication’) ->arrayPrototype() ->children() ->scalarNode(’email’)->defaultValue("%env(PEE_CMS_API_MAIL)%")->end() ->scalarNode(‘password’)->defaultValue("%env(PEE_CMS_API_PWD)%")->end() ->scalarNode(‘cache’)->defaultValue(‘PSR-6’)->end() ->end() ->end() ->end() ->scalarNode(‘base_url’)->defaultValue("%env(PEE_CMS_API_URL)%")->end() ->end() ->end() ; return $treeBuilder; the YML file : bayard_directus: authentication: email: ‘%env(PEE_CMS_API_MAIL)%’ password: ..

Read more

Is it possible to create a URL with the Symfony Router with a custom query string parameter with no value? Ideally i’d like: https://crmpicco.co.uk/details?invalid_sms the code below gives me: https://crmpicco.co.uk/details?invalid_sms=1 $router->generate(‘crmpicco_personal_details’, [ ‘invalid_sms’ => 1 ]); I have tried passing null, but that is not an accepted value Source: Symfony4..

Read more

I want to create a tree with treant.js the structure form is like this: var tree_structure=[ {container: ‘#OrganiseChart8’, levelSeparation: 70, siblingSeparation: 60, nodeAlign: ‘BOTTOM’, connectors: { type: "step", style: { "stroke-width": 2, "stroke": "#ccc", "stroke-dasharray": "–", } }, {innerHTML: ‘#first-post’}, {parent: {innerHTML: ‘#first-post’}, innerHTML: ‘#1-reply’}, {parent: {innerHTML: ‘#first-post’}, innerHTML: ‘#2-reply’} }]; new Treant(tree_structure); displaying this ..

Read more

My security.yaml has following code: security: encoders: AppEntityUser: algorithm: auto # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers providers: # used to reload user from session & other features (e.g. switch_user) app_user_provider: entity: class: AppEntityUser property: email firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false api: anonymous: lazy logout: ~ pattern: ^/api guard: authenticators: – AppSecurityTokenAuthenticator stateless: true main: anonymous: lazy provider: app_user_provider ..

Read more