doctrine

Symfony / Doctrine - Multiple Users Types

拟墨画扇 提交于 2021-01-27 20:36:52
问题 I'm creating a website that should have at least two types of users, Company and Client, two of them have the same login form and different registration forms, and they can send messages to each other ... Normaly (Without think about Doctrine) I think the database should look something like that: User (id, email, password, facebook_id, roles) Company (id, user_id, name, city, ...) Client (id, user_id, name, sex ...) Messages (id, sender_id(user_id), receiver_id(user_id), message, ...) ... So

How to fix class is not a valid entity or mapped super class?

☆樱花仙子☆ 提交于 2021-01-27 05:50:48
问题 So I'm trying to follow symfony2's tutorial on doctrine for my own website and modeling my User entity after their Product one. Also, before anyone marks this a duplicate, I have already tried the solutions given in numerous other questions with no luck: Not a valid entity or mapped super class Doctrine class is not a valid entity or mapped super class Symfony/Doctrine: Class is not a valid entity or mapped super class symfony2 is not a valid entity or mapped super class Symfony/Doctrine:

How to inject Doctrine Entity Manager into Symfony 4 Service

泄露秘密 提交于 2021-01-27 05:15:07
问题 I have a controller use Doctrine\ORM\EntityManagerInterface: class ExampleController{ public function someFunction(ExampleService $injectedService){ $injectedService->serviceFunction(); } } With a Service use Doctrine\ORM\EntityManagerInterface; class ExampleService{ public function __construct(EntityManagerInterface $em){ ... } } However, calls to someFunction() fail due to 0 parameters being passed (the EntityManagerInterface is not being injected). I am attempting to use the EntityManager

How to inject Doctrine Entity Manager into Symfony 4 Service

时光总嘲笑我的痴心妄想 提交于 2021-01-27 05:15:07
问题 I have a controller use Doctrine\ORM\EntityManagerInterface: class ExampleController{ public function someFunction(ExampleService $injectedService){ $injectedService->serviceFunction(); } } With a Service use Doctrine\ORM\EntityManagerInterface; class ExampleService{ public function __construct(EntityManagerInterface $em){ ... } } However, calls to someFunction() fail due to 0 parameters being passed (the EntityManagerInterface is not being injected). I am attempting to use the EntityManager

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 (

Doctrine: GROUP BY HAVING

你离开我真会死。 提交于 2021-01-02 07:58:05
问题 I'm trying to do this: SELECT userId, count(userId) as counter FROM quicklink GROUP BY userId HAVING count(*) >= 3' In doctrine with the querybuilder, I've got this: $query = $this->createQueryBuilder('q') ->select('userId, count(userId) as counter') ->groupby('userId') ->having('counter >= 3') ->getQuery(); return $query->getResult(); Which gives me this error: [Semantical Error] line 0, col 103 near 'HAVING count(*)': Error: Cannot group by undefined identification variable. Really

Many to many relation with ON DELETE CASCADE with Symfony and Doctrine

吃可爱长大的小学妹 提交于 2020-12-31 10:48:59
问题 I want a simple many to many relation with Symfony and Doctrine. This is really a unidirectional one-to-many association can be mapped through a join table as the docs indicate I am using a YAML file for configure this with the following code: In file Content.orm.yml: manyToMany: comments: cascade: ["persist","remove"] onDelete: CASCADE options: cascade: remove: true persist: true #refresh: true #merge: true #detach: true orphanRemoval: false orderBy: null targetEntity: Comment joinTable:

Many to many relation with ON DELETE CASCADE with Symfony and Doctrine

℡╲_俬逩灬. 提交于 2020-12-31 10:48:49
问题 I want a simple many to many relation with Symfony and Doctrine. This is really a unidirectional one-to-many association can be mapped through a join table as the docs indicate I am using a YAML file for configure this with the following code: In file Content.orm.yml: manyToMany: comments: cascade: ["persist","remove"] onDelete: CASCADE options: cascade: remove: true persist: true #refresh: true #merge: true #detach: true orphanRemoval: false orderBy: null targetEntity: Comment joinTable: