doctrine

how to deal with doctrine's lazy loading when having null-objects?

随声附和 提交于 2020-01-16 05:12:14
问题 i have a question about the correct way to handle doctrine's lazy loading mechanism. I have an entity that references another one via @ManyToOne: class Entity { ... /** * @ManyToOne(targetEntity="AnotherEntity") * @JoinColumn(name="anotherEntityId", referencedColumnName="id") */ protected $anotherEntity; ... } class AnotherEntity { /** * @var integer $id * @Column(name="id", type="integer", nullable=false) * @Id * @GeneratedValue(strategy="IDENTITY") */ private $id; /** * @var string

How can I prevent loading of related entities in Symfony2?

余生长醉 提交于 2020-01-16 04:46:05
问题 I have two entities, Order and Orderline with one-to-many relationship. I have a listing where I need only data from orders, but Doctrine makes query for orderlines for each order. I haven't joined Orderlines in the query. How can prevent Doctrine for querying the orderlines? Query used in controller: $query = $em->createQuery("SELECT o FROM SomeBundle:Order o JOIN o.shop s JOIN s.user u WHERE u.id = :user_id AND o.status = :status") ->setParameter('user_id', $user->getId()) ->setParameter(

Doctrine where in with Doctrine_Query

二次信任 提交于 2020-01-15 07:47:10
问题 is it possible to make : $q->createQuery('q') ->whereIn('q.id', $q2) Where $q2 is an other Doctrine_Query object. Because my subquery is complex and I don't want to write it in SQL... 回答1: Unfortunately, according to the Doctrine API documentation, you can't pass another query object to whereIn() , so you will have to fetch your ID-s beforehand and pass them in an array. Be careful though, because if you pass an empty array, then there will be NO FILTERING for those ID-s. In other words: it

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

混江龙づ霸主 提交于 2020-01-15 07:07:21
问题 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: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

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

How to use Stored Procedures with Symfony and Doctrine

放肆的年华 提交于 2020-01-14 08:41:27
问题 I having problems at trying to call a MySQL Stored Procedure with Symfony 1.4 and Doctrine 1.2. What I want to do is the following: In a module/new after typing all the data in the form, I want to insert one of the values in another table. I don't know if this can be done with Doctrine without using a stored procedure. Thanks for your help. 回答1: You could use triggers but I'm not sure how advanced they are in MySQL. Triggers wouldn't involve any coding in Doctrine, symfony nor PHP. Just