Skip to content

Twig accessing protected/private model variables

I have a problem with Twig, (in fact this is not really a problem but it’s disturbing to me) I have a Post model class in php and i have some protected variables (I also tried with private). To acces them I have a public function in php getMyVariable. If in my controller I try to echo the protected vari…

PHP Redirect with query parameters

Let’s say I have the following URL: What I want the PHP query to do is redirect the user to the following URL: Of course, the URL should not only redirect ?user/1234 but also ?anything/343. I want to leave the url intact and only add the /test/ to it, and leave the part afterwards the same. How do I acc…

Bootstrap with composer

I’ve downloaded bootstrapp with composer composer.json { “name”: “afern/seocom_login”, “require”: { “twbs/bootstrap”: “3.3.7” } } and I’ve included the autoload file on index….

laravel observers are not working

I am trying to listen to model events using laravel observers .The problem is when i submit my form (update or creating new records), nothing happened at all .Do i miss something ? app.php CasesManagerServiceProvider.php CasesObserver.php Cases.php Answer Ok i have found my answer . All the problem was when I…

Creating a Symfony 4 Form without Database

I’m new to symfony and want to to create a simple contact form, take the submitted values and send them as an Email. I don’t want to save anything in the database. I followed the documentation on this page: https://symfony.com/doc/current/form/without_class.html I created a new page/action with th…

How to check fetched result set is empty or not?

For example: AND How to check if result set is empty or not Answer Check $data variable like: If the result of SELECT query did return any data, variable $data will contain a non-empty array/object which evaluates to true, and a false-like value otherwise.