doctrine-orm

Fatal error HelperSet not found when setting up Doctrine Console (with CodeIgniter)

谁说我不能喝 提交于 2020-01-15 07:06:53
问题 I've got a problem setting up Doctrine with CodeIgniter. When running the following error is coming up: Fatal error: Class 'Symfony\Component\Console\Helper\HelperSet' not found in /Applications/MAMP/htdocs/CodeIgniter-2.2.1/application/doctrine.php on line 21 The folder structure looks like this /application/ /application/doctrine.php /application/libraries/ /application/libraries/Doctrine/ /application/libraries/Doctrine/Common /application/libraries/Doctrine/DBAL /application/libraries

Fatal error HelperSet not found when setting up Doctrine Console (with CodeIgniter)

纵然是瞬间 提交于 2020-01-15 07:06:08
问题 I've got a problem setting up Doctrine with CodeIgniter. When running the following error is coming up: Fatal error: Class 'Symfony\Component\Console\Helper\HelperSet' not found in /Applications/MAMP/htdocs/CodeIgniter-2.2.1/application/doctrine.php on line 21 The folder structure looks like this /application/ /application/doctrine.php /application/libraries/ /application/libraries/Doctrine/ /application/libraries/Doctrine/Common /application/libraries/Doctrine/DBAL /application/libraries

Default value of Doctrine ORM association

你离开我真会死。 提交于 2020-01-15 06:23:30
问题 I have the entity (such as below). I want to set some default values while creating. As you can see in __construct , it is easy to set the $name (string), but how can I set the $group ? (for example I know that there is a group in database with id=122 ) /** * @ORM\Entity */ class Person { private $id; /** @ORM\Column(type="string") */ private $name; /** * @ORM\ManyToOne(targetEntity="Group", inversedBy="persons") * @ORM\JoinColumn(referencedColumnName="id") */ private $group; public function

Default value of Doctrine ORM association

做~自己de王妃 提交于 2020-01-15 06:23:09
问题 I have the entity (such as below). I want to set some default values while creating. As you can see in __construct , it is easy to set the $name (string), but how can I set the $group ? (for example I know that there is a group in database with id=122 ) /** * @ORM\Entity */ class Person { private $id; /** @ORM\Column(type="string") */ private $name; /** * @ORM\ManyToOne(targetEntity="Group", inversedBy="persons") * @ORM\JoinColumn(referencedColumnName="id") */ private $group; public function

Using createNativeQuery to join two entities without foreign key

对着背影说爱祢 提交于 2020-01-15 05:36:47
问题 I want to retrieve data from two different tables depending of the value of one field (type). Basically if type is 2 or 3, relate 'subcategory_id' to category2 or category3 respectively The plain SQL: SELECT s.id, s.subcategory_id, s.type, IF(s.type = 2, c2.name, c3.name) as name FROM show_subcategory s LEFT JOIN category2 c2 ON (s.type = 2 AND s.subcategory_id = c2.id) LEFT JOIN category3 c3 ON (s.type = 3 AND s.subcategory_id = c3.id) WHERE s.category1_id = 1 ORDER BY s.order_list The

Doctrine: How to unset (SET NULL) OneToMany relationship

吃可爱长大的小学妹 提交于 2020-01-15 04:39:29
问题 This is a very very simple behavior, but I can't find the way to achieve it with doctrine. I'm going to explain it reducing the complexity with only two entities. Having two entites (Author and Book) related like "One Author owns zero or more books" and "One book is owned by zero or one author", I'm trying to unset the relation between an author and one of his books (from the author side), expecting that book.author_id field in database sets as null. The Entities are defined as follow: Author

Doctrine fixtures not working after updating to Symfony 2.1.8

不羁的心 提交于 2020-01-15 03:34:11
问题 After updating a project from Symfony 2.0.22 to 2.1.8 I get this error when executing doctrine:fixtures:load via Terminal Fatal error: Class 'Doctrine\Common\DataFixtures\Loader' not found in {symfony_install_folder}/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/DataFixtures/ContainerAwareLoader.php on line 27 The fixtures worked on 2.0.22 and I've checked the official documentation to see if I've set everything correctly My composer.json looks like this: { "name": "symfony/framework

In Doctrine, how to ignore specific column from update schema command?

不想你离开。 提交于 2020-01-15 02:38:48
问题 I have my mapped entity named Product , with just two columns: id and name . If I add another column manually, i.e. stock_qty directly with an SQL statement, the schema update tool will remote it , of course. How can I prevent Doctrine remove my custom columns, not mapped to my entity? Related issues: https://github.com/doctrine/doctrine2/issues/6434 回答1: You can define either a onSchemaColumnDefinition or a onSchemaAlterTableRemoveColumn event and ignore these columns. Using the

Doctrine is freaking out when I turn on php opcache on

最后都变了- 提交于 2020-01-14 22:51:49
问题 I'm having a really strange problem with Doctrine and PHP 5.5.6 Opcache . Everything is working just fine when the opcache module is turned off. Once I turn it on, I begin getting the following exception: Fatal error: Uncaught exception 'Doctrine\ORM\Mapping\MappingException' with message 'Class "Admin\Models\Users\Role" is not a valid entity or mapped super class.' in vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php on line 336 ( ! ) Doctrine\ORM\Mapping\MappingException:

Doctrine 2.0 ready for use?

蓝咒 提交于 2020-01-14 22:46:17
问题 I'm working on a small project (some mark tracking software for a school subject department - PHP frontend with a sqlite DB) and have decided to use ORM. I've taken a look at RedBeanPHP but it seemed a bit too limited for my liking. As such, I've decided to give Doctrine a go. My only prior experience with ORM is LINQ to SQL in .NET. Anyway, I was wondering if I should get started with Doctrine 2.0 (which is in beta at the moment) or if I should take sometime to learn 1.2. I'm looking for