How to OrderBy on OneToMany/ManyToOne

In the Product entity you just need to add the orderBy to the ingredients relation /** * @ORM\OrderBy({“some_attribute” => “ASC”, “another_attribute” => “DESC”}) */ private $ingredients; With PHP 8 attributes: #[ORM\OrderBy([‘some_attribute’ => ‘ASC’, ‘another_attribute’ => ‘DESC’])] private $ingredients;

Allow trailing slash for Symfony2 route without params?

I like @Kuchengeschmack’s answer (https://stackoverflow.com/a/11078348/593957) because it doesn’t trigger external redirects. Here’s a yaml version: acme_admin_dashboard: pattern: /{_locale}/admin{trailingSlash} defaults: { _controller: AcmeBundle:Admin:dashboard, trailingSlash : “https://stackoverflow.com/” } requirements: { trailingSlash : “[/]{0,1}” }

Symfony 2 + Doctrine 2 + PHPUnit 3.5: Serialization of closure exception

Not technically related to your issue. However, I had a really hard time trying to solve the “Serialization of ‘Closure’ is not allowed” issue while using PHPUnit, and this question is the top Google result. The problem comes from the fact that PHPUnit serializes all the $GLOBALS in the system to essential back them up … Read more