symfony

How to use Vich uploader with easyAdmin 3 on Symfony 5

﹥>﹥吖頭↗ 提交于 2021-01-21 08:34:29
问题 I've been trying to use VichUploader to upload files on a Symfony project, already using EasyAdmin 3. I've configured everything correctly, but I'm getting this error: The "pieceJointeFile" image field must define the directory where the images are uploaded using the setUploadDir() method. <?php namespace App\Entity; use App\Repository\InventaireRepository; use DateTime; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\HttpFoundation\File\File; use Vich\UploaderBundle\Mapping\Annotation

Symfony 4 how to setup SPA ( single page app ) with React?

烂漫一生 提交于 2021-01-21 05:55:05
问题 I've not been able to have Symfony 4 work properly in a SPA setup. Specifically, while I navigate using React-router links everything works as it should. But if I try accessing any of the routes ( except home ) directly, Symfony intercepts it and, of course, throws an error for route not found. The alternative of placing Symfony in a sub-domain and using it only as an API is not viable, as I need all the user and session management tools provided by the framework. Of course I will need

How to force download a .csv file in Symfony 2, using Response object?

落花浮王杯 提交于 2021-01-20 15:28:07
问题 I'm making a "Download" controller using Symfony 2, that has the sole purpose of sending headers so that I can force a .csv file download, but it isn't working properly. $response = new Response(); $response->headers->set('Content-Type', "text/csv"); $response->headers->set('Content-Disposition', 'attachment; filename="'.$fileName.'"'); $response->headers->set('Pragma', "no-cache"); $response->headers->set('Expires', "0"); $response->headers->set('Content-Transfer-Encoding', "binary");

“Argument 1 passed to ApiPlatform\Core\Bridge\Doctrine\Orm\Metadata\Property\DoctrineOrmPropertyMetadataFactory::__construct() must be an instance…”

我怕爱的太早我们不能终老 提交于 2021-01-20 08:53:45
问题 While attempting to install Api-Platform (or run composer update on an existing Api-Platform installation, I get an error like this: Uncaught Error: Argument 1 passed to ApiPlatform\Core\Bridge\Doctrine\Orm\Metadata\Property\DoctrineOrmPropertyMetadataFactory::__construct() must be an instance of Doctrine\Common\Persistence\ManagerRegistry, instance of Doctrine\Bundle\DoctrineBundle\Registry given, called in App_KernelDevDebugContainer.php on line 1530 ["exception" => TypeError { …}] What can

Order of Symfony form CollectionType field

百般思念 提交于 2021-01-18 09:56:04
问题 In my model I have a Recipe entity and Ingredient entity. In Recipe entity, the relation is defined like this: /** * @ORM\OneToMany(targetEntity="Ingredient", mappedBy="recipe", cascade={"remove", "persist"}, orphanRemoval=true) * @ORM\OrderBy({"priority" = "ASC"}) */ private $ingredients; In Ingredient entity: /** * @ORM\ManyToOne(targetEntity="Recipe", inversedBy="ingredients") * @ORM\JoinColumn(name="recipe_id", referencedColumnName="id") */ private $recipe; I am working on CRUD controller

Order of Symfony form CollectionType field

喜欢而已 提交于 2021-01-18 09:55:04
问题 In my model I have a Recipe entity and Ingredient entity. In Recipe entity, the relation is defined like this: /** * @ORM\OneToMany(targetEntity="Ingredient", mappedBy="recipe", cascade={"remove", "persist"}, orphanRemoval=true) * @ORM\OrderBy({"priority" = "ASC"}) */ private $ingredients; In Ingredient entity: /** * @ORM\ManyToOne(targetEntity="Recipe", inversedBy="ingredients") * @ORM\JoinColumn(name="recipe_id", referencedColumnName="id") */ private $recipe; I am working on CRUD controller

Order of Symfony form CollectionType field

丶灬走出姿态 提交于 2021-01-18 09:48:26
问题 In my model I have a Recipe entity and Ingredient entity. In Recipe entity, the relation is defined like this: /** * @ORM\OneToMany(targetEntity="Ingredient", mappedBy="recipe", cascade={"remove", "persist"}, orphanRemoval=true) * @ORM\OrderBy({"priority" = "ASC"}) */ private $ingredients; In Ingredient entity: /** * @ORM\ManyToOne(targetEntity="Recipe", inversedBy="ingredients") * @ORM\JoinColumn(name="recipe_id", referencedColumnName="id") */ private $recipe; I am working on CRUD controller

How to use mysql variables in doctrine

痞子三分冷 提交于 2021-01-08 05:52:51
问题 https://stackoverflow.com/a/12772507/1507546 I want to execute this query through doctrine but I'm getting the error below [Doctrine\DBAL\Driver\PDOException] SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@counter := 0' at line 1 Here is my code $sql = <<<S SET @counter = 0; Select sub.orderid,sub.value,(@counter := @counter +1) as counter FROM (

How to use mysql variables in doctrine

丶灬走出姿态 提交于 2021-01-08 05:51:33
问题 https://stackoverflow.com/a/12772507/1507546 I want to execute this query through doctrine but I'm getting the error below [Doctrine\DBAL\Driver\PDOException] SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@counter := 0' at line 1 Here is my code $sql = <<<S SET @counter = 0; Select sub.orderid,sub.value,(@counter := @counter +1) as counter FROM (

How to use mysql variables in doctrine

Deadly 提交于 2021-01-08 05:51:26
问题 https://stackoverflow.com/a/12772507/1507546 I want to execute this query through doctrine but I'm getting the error below [Doctrine\DBAL\Driver\PDOException] SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@counter := 0' at line 1 Here is my code $sql = <<<S SET @counter = 0; Select sub.orderid,sub.value,(@counter := @counter +1) as counter FROM (