Category : symfony4

Imagine I want to have xsi:schemaLocation namespace and attribute in root: <root xsi:schemaLocation="url">…</root> How can I do it in JMS/Serializer in Symfony 4? I have this class on which I want to have this attribute on its root element when serializing, see the class snippet: /** * @XmlRoot("partner") * @XmlNamespace(uri="http://www.w3.org/2001/XMLSchema-instance", prefix="xsi") */ class PartnerInfo implements ..

Read more

After following the documentation, my new OPCache settings are like this: opcache.preload_user=www-data opcache.preload=/var/www/vhosts/…/httpdocs/…/var/cache/prod/App_KernelProdContainer.preload.php opcache.memory_consumption=1024 opcache.interned_strings_buffer=256 opcache.max_accelerated_files=20000 opcache.validate_timestamps=0 By default, inside var/cache/prod folder there is a file named srcApp_KernelProdContainer.preload.php. After deleting /cache folder & restarting PHP-FPM, App_KernelProdContainer.preload.php is not created. Should I rename App_KernelProdContainer.preload.php to srcApp_KernelProdContainer.preload.php or am I missing something else? Source: Symfony4..

Read more

I am trying to create a dynamic form with two dynamic form elements. I’ve followed the examples from https://symfony.com/doc/current/form/dynamic_form_modification.html#dynamic-generation-for-submitted-forms I can create a form which shows the new form element Position after selecting and submitting Sport. However lets say after choosing a Position and submitting they have to choose a colour, how would you do ..

Read more

in my symfony project i have a function that shows a list of users based on their "roles" here’s the controller code /** * @Route("/admin", name="admin_index", methods={"GET"}) */ public function index(): Response { $Admins=$this->getDoctrine()->getRepository(User::class)->findBy([‘roles’ => array(‘["ROLE_ADMIN"]’)]); return $this->render(‘back/admin/index.html.twig’, [ ‘admins’ => $Admins, ]); } and here’s the render <table class="table" > <thead> <tr> <th>Id</th> <th>Nom</th> ..

Read more

I develop a Symfony project (version 4.4) and I want to use the bundle omines/datatables-bundle to get good tables, but when I try I have : Argument 1 passed to OminesDataTablesBundleAdapterDoctrineORMAdapter::__construct() must be an instance of DoctrineCommonPersistenceManagerRegistry or null, instance of DoctrineBundleDoctrineBundleRegistry given I searched and it seems to be a version problem between Symfony, ..

Read more