FAQ Database Discussion Community


Update session in symfony2 for shoppingg cart

php,symfony2,symfony-2.1,php-5.3,symfony-2.3
I have the following code : public function addAction(Request $request){ //Get submited data // Get Value from session $sessionVal = $this->get('session')->get('aBasket'); // Append value to retrieved array. $aBasket = $request->request->all(); if(count($sessionVal) > 0) { foreach ($sessionVal as $key=>$value) { if($aBasket['product_id'] == $sessionVal[$key]['product_id']) { $sessionVal[$key]['product_quantity'] = $sessionVal[$key]['product_quantity'] + $aBasket['product_quantity'];...

Verify if user is authentificated in symfony2

php,symfony2,symfony-forms,symfony-2.1,symfony-2.3
I tried to create a simple login application in symfony2 and I don't understand a thing. My routing file : shop_show_login_page: path: /login defaults: { _controller: ShopDesktopBundle:User:loginPage } shop_login_user: path: /loginUser defaults: { _controller: ShopDesktopBundle:User:loginCheck } My controller with this 2 methods : public function loginPageAction(){ return $this->render('ShopDesktopBundle:User:loginPage.html.twig'); } public...

Login system in symfony 2

php,symfony2,symfony-2.1,symfony-2.3,php-5.4
I tried to create an authentification system in symfony2 but no results. In the debug status bar for all situations I have : Logged as anon. If I make a dump of session in the view I get : "_security.last_error" => BadCredentialsException My routing file: shop_show_login_page: path: /login defaults: {...

Symfony2 - Locale in unit tests

unit-testing,locale,symfony-2.1
I'm from Germany and at work we use an old Symfony2 Version (2.1). I wrote a twig filter named "GermanDateExtension". public function getGermanDateFilter($date, $format) { setlocale(LC_TIME, 'de_DE.utf8'); return strftime($format, $date); } Locale is set via setlocale() and the formatted date will be returned. I also wrote some unit tests for...