[doctrine-user] Is there a Doctrine pattern for a common JOIN? | Am I using Doctrine correctly?

2015-10-06 Thread Dennis Fedco
I am just starting to use Doctrine again after a long break. I used Doctrine before lightly, more so following simple examples in a tutorial. Now, I am evaluating using it in a real project that uses multiple databases and joins that span across several databases and tables. So far I am

[doctrine-user] How to best define (or handle) a foreign keys in legacy tables that were not handled by Doctrine's "convert-mapping"/"generate-entities"?

2016-05-16 Thread Dennis Fedco
I am working with a legacy codebase, and a database that has no foreign key constraints defined, nor has referential integrity. And what I'm doing is I am modeling my Doctrine entities in PHP to match MySQL tables, so that I can use Doctrine inside PHP code. And so first I build my Entities to

[doctrine-user] Best Practice for Retrieving records by using Foreign Key

2016-05-16 Thread Dennis Fedco
I found this: http://pietervogelaar.nl/doctrine-2-use-foreign-key-as-field-in-dql The posts in the link are from 2-3 years ago and recommend using an IDENTITY function. I am curious if using IDENTITY is still a recommended practice? I find it that in some of my code I have been unwittingly

Re: [doctrine-user] Unexpected differences in Result Set data structure for similar DQL statements

2016-05-16 Thread Dennis Fedco
as before "(all mixed results in a one-dimension array)" INNER JOIN ' . Product::class . ' p WITH i.product = p.id For now I liked the suggested DQL the best, as so: SELECT i,p FROM ' . Item::class . ' i JOIN i.product p WHERE ... Dennis On M

[doctrine-user] Why is DoctrineProxies object so huge?

2016-05-06 Thread Dennis Fedco
I posted a question about DoctrineProxies construct that lives inside Doctrine\ORM\Configuration and creates huge proxy objects. http://stackoverflow.com/questions/37076711/why-does-doctrine-orm-configurations-doctrineproxies-object-contain-the-unive I will be curious to see if someone can

[doctrine-user] Unexpected differences in Result Set data structure for similar DQL statements

2016-05-06 Thread Dennis Fedco
*Peculiarity #1* I have some code, like so: $query = $this->getEntityManager()->createQuery(' SELECT i, p FROM ' . Item::class . ' i INNER JOIN ' . Product::class . ' p WHERE i.productId = p.id ');

[doctrine-user] Why use Entities for foreign keys (What is the benefit)?

2016-08-02 Thread Dennis Fedco
I am using Doctrine "in reverse" in that I have some legacy code that I am refactoring, and I am fitting in Doctrine to be on top of already existing tables. So for example I have a table like so: item(id, description, motor_id, product_id, drive_id); I also have the corresponding tables for

[doctrine-user] Doctrine ProxyGenerator issues a PHP warning when trying rename()

2016-08-15 Thread Dennis Fedco
I am getting hundreds of errors like this PHP Warning: rename(/tmp/__CG__NamespaceEntityProduct.php.57b1fb60e11ee5.96791162,/tmp/__CG__NamespaceEntityProduct.php): Operation not permitted in /../vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php on line 306 Have anyone had

[doctrine-user] Re: Can I relate an Entity to a Many-To-Many relation in Doctrine?

2016-09-06 Thread Dennis Fedco
In other words, considering this example: https://gist.github.com/Ocramius/3121916 (which creates table user_usergroup as relation between entities User and UserGroup) Can I create a new entity that uses table user_usergroup in a mapping directly? The problem I am trying to solve is (using

[doctrine-user] How to model this ER diagram in Doctrine

2016-09-08 Thread Dennis Fedco
To follow up on my last question.. and if you like a challenge, here is something I've designed and now trying to implement in Doctrine: http://stackoverflow.com/questions/39397170/how-do-i-model-my-er-diagram-when-doctrine-wont-let-me-associate-composite-fore I have made category_pricename

[doctrine-user] Is it a good practice to keep/maintain Doctrine and non-Doctrine ways of setting foreign keys?

2016-09-20 Thread Dennis Fedco
When foreign key integer value is already known ... Is it a good practice to have both methods for: - setting foreign ID directly by using its integer value - setting foreign ID by using the associated Entity Example: $item = new Item(); //setting foreign key by its integer value

[doctrine-user] How do you explain conceptual connection between an Integer and an Object Instance?

2016-08-22 Thread Dennis Fedco
Using this example: Basic Many-To-One Mapping I am having a hard time connecting these concepts: - concept of a database column that is foreign key -- an integer