Automatic post-registration user authentication

Symfony 4.0 This process hasn’t changed from Symfony 3 to 4 but here is an example using the newly recommended AbstractController. Both the security.token_storage and the session services are registered in the parent getSubscribedServices method so you don’t have to add those in your controller. use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use YourNameSpace\UserBundle\Entity\User; class LoginController extends AbstractController{ … Read more

Symfony3 ClassNotFoundException after bundle creation

I just installed a fresh copy of S3.3.4 (latest version as of this writing) using: composer create-project symfony/framework-standard-edition s334 “3.3.4” bin/console generate:bundle Share across multiple apps: yes namespace: Paul\ArtBundle bundle name: PaulArtBundle Target Directory: src/ Refreshed the browser and sure enough I got the class not found message. The generate:bundle command is not updating the … Read more

Composer require runs out of memory. PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted

To get the current memory_limit value, run: php -r “echo ini_get(‘memory_limit’).PHP_EOL;” Try increasing the limit in your php.ini file (ex. /etc/php5/cli/php.ini for Debian-like systems): ; Use -1 for unlimited or define an explicit value like 2G memory_limit = -1 Or, you can increase the limit with a command-line argument: php -d memory_limit=-1 composer.phar require hwi/oauth-bundle … Read more

Symfony 3, Guard & Handlers

The new Guard is aimed to ease the implementation of custom authentication patterns such as yours. It is likely to be enough for most of the case even complex ones. However, try to extract your custom processing, logging, etc. from your Guard and inject them to improve the maintainability of it. Take a close look … Read more

How to get the value from and save to Database in php

You have at least two options here: hidden fields everywhere if data (best approach): <td> <input type=”checkbox” name=”checkBox[]” id=”ic” value=”{{ user.id }}” /> <input type=”hidden” value=”{{user.lastname}}” name=”v1[{{ user.id }}]”></td> <td data-title=”id”>{{user.id}}</td> <td data-title=”firstName”>{{user.firstname}}</td> <td data-title=”lastName” contenteditable=”true”>{{user.lastname}}</td> and on serverside you do: …. your code …. foreach ($user as $id) { $lastname = $v1[$id]; … save … Read more

Unable to download Symfony2 from Git

There is a very straightforward tutorial on how to set up your own Symfony project: http://symfony.com/download I will not copy the tutorial, just mention two points: To install and upgrade Symfony, you will have to use Composer. (Details in the tutorial.) Symfony code is actually hosted on Github, but those are only some of the … Read more