doctrine

Is there a good comparison of Doctrine vs Propel?

拟墨画扇 提交于 2020-01-02 04:11:12
问题 I've seen plenty of comparisons of Doctrine vs Propel, but none of them has actually convinced me to choose Doctrine over Propel. I've been using Propel for a while now and almost every comparison I read states that Propel is not well documented as the first problem and I've read Propel's docs and they're quite well. Also, most of comparisons are dated, (using Propel 1.5+). Does anyone knows of a highly convincing post in a blog where I can see test results and some actual differences? 回答1: I

Symfony2 - The class 'X' was not found in the chain configured namespaces

ⅰ亾dé卋堺 提交于 2020-01-02 03:23:22
问题 I've been searching forever to solve my problem. But I can't find any solution. I always get this error message when I try to open the homepage: Uncaught exception 'Doctrine\Common\Persistence\Mapping\MappingException' with message 'The class 'Test\Bundle\UserBundle\Entity\User' was not found in the chain configured namespaces ' in... The weird thing is that I only get it when I have following URL: http://localhost/ But when I run it on this URL I don't get any error and my page is being

Table naming convention with Doctrine ORM

谁说我不能喝 提交于 2020-01-02 01:53:06
问题 Is there a convention for naming tables when using Doctrine ORM? I like to name tables with the plural but if there's a convention I want to stick to it. So the table 'users' would be related to tables using the fk as the singular ('user_id'). Is there a best practice for this (using singular or plural table names) and if the latter, how does this apply to tables where the plural isn't a simple case of adding an 's'. For example I currently have a table called 'categorys' instead of

symfony2 doctrine select IFNULL

故事扮演 提交于 2020-01-02 01:02:27
问题 Ok i have this code: SELECT IFNULL(s2.id,s1.id) AS effectiveID, IFNULL(s2.status, s1.status) AS effectiveStatus, IFNULL(s2.user_id, s1.user_id) as effectiveUser, IFNULL(s2.likes_count, s1.likes_count) as effectiveLikesCount FROM statuses AS s1 LEFT JOIN statuses AS s2 ON s2.id = s1.shared_from_id WHERE s1.user_id = 4310 ORDER BY effectiveID DESC LIMIT 15 And i need to rewrite it to querybuilder. Something like that? $fields = array('IFNULL(s2.id,s1.id) AS effectiveID','IFNULL(s2.status, s1

Creating a one to many polymorphic relationship with doctrine

六眼飞鱼酱① 提交于 2020-01-02 00:36:06
问题 Let me start by outlining the scenario. I have a Note object that can be assigned to many different objects A Book can have one or more Note s. An Image can have one or more Note s. A Address can have one or more Note s. What I envision the database to look like: book id | title | pages 1 | harry potter | 200 2 | game of thrones | 500 image id | full | thumb 2 | image.jpg | image-thumb.jpg address id | street | city 1 | 123 street | denver 2 | central ave | tampa note id | object_id | object

what does “the entities are privately owned” means (as seen in Doctrine official documentation)?

我的梦境 提交于 2020-01-02 00:31:38
问题 I have read the following in doctrine documentation that does not mean much to me: "When using the orphanRemoval=true option Doctrine makes the assumption that the entities are privately owned and will NOT be reused by other entities." here the link where you can find the sentence in its context. doctrine offical documentation Can someone could give me an exemple of privately own entities in a ManyToMany relationship between entities? 回答1: Imagine you're storing some user settings in a

Symfony 2 - Clone entity with one to many sonata media relationship

一笑奈何 提交于 2020-01-01 19:18:05
问题 I have a Product entity with a one to many relationship with the media entity /** * @ORM\OneToMany(targetEntity="Norwalk\StoreBundle\Entity\ProductHasMedia", mappedBy="product", cascade={"persist"}, orphanRemoval=true ) */ protected $imagenes; And a one to one relationship with a Package entity /** * @ORM\OneToOne(targetEntity="Package", cascade={"persist"}) * @ORM\JoinColumn(name="package", referencedColumnName="id") */ protected $package; I am able to clone the Product entity with this

doctrine2 - querybuilder, empty parameters

大憨熊 提交于 2020-01-01 19:00:13
问题 what can i do if the parameter has no value? my query: $query = $this->_em->createQueryBuilder() ->select('u') ->from('Users', 'u') ->where('u.id = ?1') ->andWhere('u.status= ?2') ->setParameter(1, $userid) ->setParameter(2, $status) ->getQuery(); return $query->getResult(); if theres no $status, then it doesnt display anything. i tried putting a condition before the query to check if its null but what value can i set $status iif theres no status set 回答1: The query builder is exactly there

Set parameter for Doctrine filter on every request in Symfony2

扶醉桌前 提交于 2020-01-01 18:13:11
问题 I have a Doctrine filter in Symfony2 project. I am trying to set filter's parameter to some value (taken from session) on every request. The problem is that filter object is created after Symfony's onKernelRequest event, so I can't set it from there. If I try to set it in Doctrine's postConnect event circular dependency is detected: ServiceCircularReferenceException: Circular reference detected for service "doctrine.orm.private_entity_manager", path: "routing.loader -> assetic.asset_manager -

Migrating Existing Users and Passwords to new Symfony/sfDoctrineGuard User System

陌路散爱 提交于 2020-01-01 17:42:36
问题 I have an existing, non-framework-based PHP/MySQL website. It has a simple security model, with a users table with usernames and hashed (MD5) passwords. I'm currently working on "version 2" of this site, this time using Symfony, with Doctrine. The new version is working fine, and I'm using the sfDoctrineGuard plugin for my user management. I'd like to migrate my existing users into the new app with the minimum of fuss, retaining their existing usernames and passwords. My main problem, though,