For last few days I’m experiencing following issue with doctrine – since I am not allowed to paste any source code, I’ll try to describe briefly: I am using doctrine orm and I need to add a new column to an existing table in DB – mapping between DB and entities is done via xml mapping file – here are
Tag: doctrine
How to select certain fields with mongodb doctrine in symfony2
I want to find some documents from my mongo Database, and I’m using the function : FindBy() unfortunately this function doesn’t have any field selection arguments like native mongodb driver has with the function : find(). Does any one know how to select custom fields in the doctrine of Mongodb ? Thanks Answer You will need to use QueryBuilder with
Object-Relational Mapping vs Database Abstraction Layer
I’m using Doctrine which provides both ORM and DBAL. What is difference between them? How should one decide when to use which?
How to force Doctrine to update array type fields?
I have a Doctrine entity with array type field: /** * @ORMTable() */ class MyEntity { (…) /** * @var array $items * * @ORMColumn( type=”array” ) */ private $…
Working with two entity managers in the same bundle in Symfony2
I’m trying to work with two entity managers for the same bundle. My configuration is like this: Is there any way to tell which entities belong to which entity manager? It crashes now if I want to work with a table which doesn’t belong to the default entity manager. UPDATE here is my configuration for the connection: Answer For using
How to retrieve an entity with all of its associations using EntityManager in Doctrine2?
I have a simple entity with many-to-many and one-to-many associations. I’m aware of ‘Joins’ for fetching related associations which is a manual solution for my problem. How can I fetch an entity with all of its associations using EntityManager in Doctrine2? e.g.: Answer Doctrine 2 uses Proxy classes for lazy loading, so you don’t actually need to have the associations’
How to query NOT NULL with Doctrine?
I have table Test: I want result where name is NOT NULL: How can i get with: and in model with: Answer Try this: which is standard SQL syntax. Doctrine doesn’t convert Null values into proper sql.
Delete old migrations differences
How can I delete the old migrations differences? When doing doctrine:generate-migrations-diff I get no problems, but when doing the doctrine:migrate I get problems. It seems as if doctrine is trying …
Doctrine 2: Update query with query builder
Hi I’ve got the following query but it doesn’t seem to work. This returns the following error message: Fatal error: Uncaught exception ‘DoctrineORMQueryQueryException’ with message ‘[Semantical Error] line 0, col 38 near ‘testusername WHERE’: Error: ‘testusername’ is not defined.’ in … I would be glad of any help Answer I think you need to use ->set() It’s much safer to
How do I set a MysQL variable (time_zone) from within doctrine / symfony?
I would like to know how I can set the MySQL time zone to UTC (SET time_zone = ‘UTC’) from within Symfony/Doctrine, so when I call a UNIX_TIMESTAMP() function on a DATETIME field in my query, it returns the UTC unix time and not unix time in the server’s time zone. How can I do this, either automatically upon every