doctrine

Could not find any fixture services to load

蹲街弑〆低调 提交于 2020-08-10 18:07:18
问题 i know this question has been asked already multiple times: Symfony 3.4 and Fixtures Bundle issue with bundle version 3.0 Symfony 3.4.0 Could not find any fixture services to load Symfony Doctrine can't find fixtures to load Could not find any fixture services to load - Symfony 3.2 None of the above actually helped me out. That said, this is my configuration: Composer.json "require": { "php": ">=7.0", "doctrine/doctrine-bundle": "^1.6", "doctrine/orm": "^2.5", .... }, "require-dev": { ....

Could not find any fixture services to load

三世轮回 提交于 2020-08-10 18:04:07
问题 i know this question has been asked already multiple times: Symfony 3.4 and Fixtures Bundle issue with bundle version 3.0 Symfony 3.4.0 Could not find any fixture services to load Symfony Doctrine can't find fixtures to load Could not find any fixture services to load - Symfony 3.2 None of the above actually helped me out. That said, this is my configuration: Composer.json "require": { "php": ">=7.0", "doctrine/doctrine-bundle": "^1.6", "doctrine/orm": "^2.5", .... }, "require-dev": { ....

How to add an extra information on api-platform result

邮差的信 提交于 2020-08-09 07:02:36
问题 I'am using symfony and api platform. I have a ressource with : /** * @ApiResource() */ class Credit { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="integer") */ private $value; } the result of /api/credits is : { "@context": "/api/contexts/Credit", "@id": "/api/credits", "@type": "hydra:Collection", "hydra:member": [ { "@id": "/api/credits/1", "@type": "Credit", "id": 1, "value": 200, "createdAt": "2019-03" }, { "@id": "/api

How to configure apcu for doctrine in Symfony5

被刻印的时光 ゝ 提交于 2020-06-26 07:26:29
问题 In Symfony4 I was using the following configuration for doctrine apcu caching: doctrine: orm: auto_mapping: true auto_generate_proxy_classes: false metadata_cache_driver: apcu query_cache_driver: apcu result_cache_driver: apcu After upgrading to Symfony5 I am getting an error: Unknown cache of type "apc" configured for cache "metadata_cache" in entity manager "default". When changing the it to the following configuration it works: doctrine: orm: auto_mapping: true auto_generate_proxy_classes:

How to set initial data (not test data) in Symfony with doctrine ORM

≡放荡痞女 提交于 2020-06-22 22:33:08
问题 I am new to learning Symfony, (Symfony 4.1.6) and can't figure this out. I have a database, and it contains a lot of tables for populating html select type inputs. they are in the database to ensure Foreign Key constraints in other records. Is there a way to "add" this data to the database and track it? (via git) or should I resort to keeping an SQL file of just the "inserts" I have looked at Fixtures but they seem to be mostly for dummy data. I want to insert real data. What is the "best

Return array, not object from Doctrine query - Symfony2

放肆的年华 提交于 2020-06-10 02:25:06
问题 I'm using this: $this->getDoctrine()->getRepository('MyBundle:MyEntity')->findAll(array(), Query::HYDRATE_ARRAY); I thought that should ensure it returns an array of an array, but it still returns an array of objects. I need the whole result returned as an array of an array so I can do this kind of thing (silly example, but it explains what I mean): <?php $result = $this->getDoctrine()->getRepository('MyBundle:MyEntity')->findAll('return-an-array'); ?> This is the age of the person at the 5th

Doctorine check if record exists in database [duplicate]

吃可爱长大的小学妹 提交于 2020-05-17 03:43:02
问题 This question already has an answer here : Doctrine - check if record exists based on field (1 answer) Closed 4 years ago . I would like to check if a record exist in the database. The only thing it needs to return is true or false. I'm now using the following query to get the record. Is the an other command as getResult() to check if the record exists? return $this->createQueryBuilder('u') ->andWhere('u.email = :email AND u.id != :id') ->setParameter('email', $email) ->setParameter('id',

Doctorine check if record exists in database [duplicate]

╄→尐↘猪︶ㄣ 提交于 2020-05-17 03:43:00
问题 This question already has an answer here : Doctrine - check if record exists based on field (1 answer) Closed 4 years ago . I would like to check if a record exist in the database. The only thing it needs to return is true or false. I'm now using the following query to get the record. Is the an other command as getResult() to check if the record exists? return $this->createQueryBuilder('u') ->andWhere('u.email = :email AND u.id != :id') ->setParameter('email', $email) ->setParameter('id',