"Class XXX is not a valid entity or mapped super class" after moving the class in the filesystem

I had an entity class in Aib\PlatformBundle\Entity\User.php I had no problems trying to create its form class through php app/ console doctrine:generate:form AibPlatformBundle:User Now I have...

How to check if a block exists in a twig template - Symfony2

Imagine I have something like this in my twig template {% block posLeft %} ----- {%endblock%} Is there any way to check for existance of the posLeft block without calling to: block("posLeft")...

Custom i18n routing in Symfony

I'm using JMS\I18nRoutingBundle, Gedmo\Translatable and Gedmo\Sluggable. Routes with default locations works as well, but other locales works without translated slug. My i18n routing have...

What does the tilde (~) mean in my composer.json file?

I have this line in my composer.json file: "require": { ... "friendsofsymfony/user-bundle": "[email protected]", ... }, What does the tilde ~ in [email protected] exactly mean? Is that a placeholder...

Symfony database password using special characters

I'm actually having an issue with Symfony and my database password. The password contains several special characters such as for example : 65RfK_&$+4 Reading the doc, they said that we actually...

Add a FULLTEXT index in Doctrine 2 using annotations?

I know that Doctrine 2 doesn't support FULLTEXT indexes. I'm actually using a result set mapping and native queries to FULLTEXT search innodb tables (MySQL 5.6). But I still need to mark one or...

Error "could not delete" with Composer on Vagrant

I have a Vagrant running Linux and I'm trying to install Symfony. After the command composer create-project symfony/framework-standard-edition ./ "2.5.*" I have the error : [RuntimeException] ...

Compare dates between datetimes with Doctrine

I have a Symfony2 application with a table that contains a date field, whose type is DateTime. I need to get all the entities where that field value is now. If I uses the following code, I get 0...

Symfony get user defined with different classes for roles

I'm trying to get the following thing work : I have two roles in my application let's say ROLE_USER and ROLE_SUPERUSER. My users are stored in a database using Doctrine Users with role ROLE_USER...

Symfony2 fetch data from entity with OneToMany relation

I have two entities: Ad and AdPhoto. They have relation: OneToMany(Many AdPhoto to one Ad). After persist, I tried to get AdPhoto from Ad by method Ad::getPhoto(), but I get PersistentCollection...

Symfony own vendor bundle dependencies

So I have created my own vendor bundle that will essesntially contain our "in-house" framework which will be required by all our application using composer. I have followed this guide:...

PHP find variable type from property through annotation

I'm developing a web application with Symfony 3 from an existing project for over 8 years. Therefore I inherit an existing model. Some entities have this field /** * @var integer * *...

Doctrine parameter to create lower-case tables?

Doctrine creates tables with names similar to the entities, using the same case. The problem is, of course, that some systems or environements have different settings, which may lead to issues...

Can't handle exception with try/catch

I'm using Goutte (which uses Guzzle) to extract content and my script ends with an error although I'm running in try/catch: Error: Client error: `GET http://example.com/C42C9CA3` resulted in a...

Symfony - Is it better to use a service factory or a service configurator?

There seems to be two ways to dynamically instantiate a service in Symfony: Using a factory (https://symfony.com/doc/current/service_container/factories.html) Using a configurator...

How to test if a session already exists?

How can I test if a session exists in symfony? Without the framework we proceed like this: <?php if( isset($_SESSION['login'])) { echo 'Bonjour '.$_SESSION['login'].' vous etes...

Symfony If Statements

I am hoping to get some assistance with Symfony 'if' statements. Essentially I am trying to do, if the price value is equal to or greater than $500, display 'Free Shipping', if otherwise, display...

Symfony 2 debug toolbar not showing

Symfony debug toolbar doesn't show up, I tried to check a lot of things, but no luck so far. I am running site on app_dev.php environment, my config_dev.yml has: web_profiler: toolbar:...

Why Symfony doesnt autowire mailer, router?

Im using Symfony 4. I want to use Router and mailer in my services. I am including them using Dependency injection. public function __construct(Swift_Mailer $mailer, EngineInterface $templating,...

List items from RSS feed in Twig

Trying to list out the items from a blog rss feed. I've add the following controller: /** * @Route("/rss", name="rss", * options={"sitemap" = true} * ) */ ...

Error: Cannot instantiate interface symfony when unit testing

I'm trying to do a unit test for a signup method and im following this guide. I'm fairly new to unit testing. i keep getting App\Tests\Controller\SignUpControllerTest::testSignUp Error:...

PhpUnit not executing via PhpStorm remote interpreter in Docker

The issue I've got is that PhpUnit does not function (properly, something does happen) when just plain clicking "Run" (Shift + F10 on Windows) in PhpStorm. First up, followed tutorials/setup...

EasyAdmin: Display integer cent-amount as Euro/Dollar (like MoneyType with `divisor`) in list view

When storing a currency value as integer (i.e. Cent), is there a way to display it in list view as Euro/Dollar? Example: € 900 are stored in the database as 90000. EasyAdmin displays this as...

My profiler toolbar isn't showing up in symfony 4.3.1

In my .env file, I have specified my app environment to be dev and debug to be true like so: APP_ENV=dev APP_DEBUG=true In my config/packages/dev/web_profiler.yaml file I have the...

MonoLogger 9 Levels deep aborting normalization

I am trying to log a request that we are sending via guzzle which is deeply nested (upto 10-11 levels deep to be precise). Logging the request with Monolog spits out: Over 9 levels deep, aborting...

AMQPException Library error: table too large for buffer

I am using the messenger component in a Symfony application to process messages from rabbitmq. When I send a 2-3mb message and an error occurs in my handler, the middleware that tries to send the...

Symfony 5 - Semaphore extension (sysvsem) is required

I have implemented the brand new Symfony authentication system : https://symfony.com/doc/current/security/experimental_authenticators.html And I added the new Login Throttling :...

php+symfony - phpunit test - Cannot instantiate interface error

I'm trying to write my first php unit test. But I get the next error: Error: Cannot instantiate interface Doctrine\Persistence\ManagerRegistry What is the reason and how can I fix that? I'm...

How to create go back button after reload Symfony/twig

I use Symfony 4.4. I have a go back button in my Twig template. {% if previousPageboolean == false %} <a class="d-block text-decoration-none cursor px-4 pt-3"...

Symfony 5 Fast Track: Database access error

I'm trying to go through the aforementioned tutorial, but I get stuck on the stage between Step 7 and 9 - when the database goes into action. On local server I get An exception occurred in...