Questions tagged [doctrine-orm-postgres]

Version 2 of the Doctrine ORM used with postgreSQL

12 questions
10
votes
1 answer

Doctrine ORM: Persisting collections with Composite Primary Keys composed of Foreign Keys

I'm guessing this is a Doctrine bug (and I've submitted an issue on JIRA issue tracker), but in case it's just user error I decided to post it here. SYNOPSIS Persisting a collection of entities in a join table with a Composite Primary Key made up…
dyelawn
  • 750
  • 5
  • 17
9
votes
1 answer

PostgreSQL index for like 'abc%' searching

I have postgreSQL table with city list (>1M) and I need to search over this table by pattern like 'abc%'. I created B-tree index on city.name column, and here is what i got: EXPLAIN SELECT * FROM city WHERE NAME ~~* 'Мос%' Seq Scan on city …
Eddie
  • 1,436
  • 5
  • 24
  • 42
5
votes
3 answers

schema update with doctrine2 postgresql always DROPs and then ADDs CONSTRAINTs

When updating schema, doctrine always drops and add constraints. I think, it is something wrong... php app/console doctrine:schema:update --force Updating database schema... Database schema updated successfully! "112" queries were executed php…
3
votes
0 answers

How to use Doctrine 2 DQL ON to override default JOIN condition

For starters, it is NOT a duplicate of Doctrine 2 JOIN ON error. I am indeed getting Expected end of string, got 'ON' but using WITH won't solve my case. The problem there is similar but different from mine. I don't need to add a condition to my…
KotBehemot
  • 111
  • 8
3
votes
2 answers

Escape a literal so that it is wrapped with double quotes

We use doctrine 2 and want to write parameterised code like this: attributes @> \'{' . $con->quote($attrId) . ':' . (int)$value . '}\''; to have a query like this: WHERE attributes @>'{"color":14}'; The "color" is the custom (user chosen) name of…
2
votes
1 answer

Postgres date_trunc(text, timestamp) with Doctrine 2 in Symfony?

How to use Postgres date_trunc(text, timestamp) function with Doctrine 2 in Symfony?
Guido Lodetti
  • 739
  • 2
  • 8
  • 20
2
votes
1 answer

symfony2 leftjoin condition on right - losing data

I have 3 entities . "Ejuridique" has 1 relation "onetomany" with . "Project" has 1 relation "onetomany" with . "Photo" When I do 1 query on "Ejuridique" and cascading left join on "Project" and after on "Photo", adding conditions on projects and…
2
votes
2 answers

Cannot bind string value in Doctrine DBAL using bindValue, Postgresql

I'm trying to use Doctrine DBAL in my project; my database is Postgresql. This is a simple use case and I really do not know why is this not working. $query = "SELECT * FROM table ORDER BY field :order LIMIT :amount"; Let's assume that: $order =…
Kamil
  • 221
  • 1
  • 2
  • 11
1
vote
1 answer

Doctrine 2.5 GUID field default value

I am trying to set a default value for an UUID type field /** * @var int * * @ORM\Column(name="uuid", type="guid", options={"default"="uuid_generate_v4()"}) * @ORM\Id() * @ORM\GeneratedValue(strategy="UUID") */ private $uuid; However this…
1
vote
1 answer

Simple DQL request using Doctrine2 & Postgresql

I want to use the query_builder in a Symfony2 FormType, I tried to make a simple request in my Postgresql shema using Doctrine DQL. It return me an error and i don't really understand how fix it : PDOException: SQLSTATE[42601]: Syntax error: 7…
1
vote
5 answers

Doctrine2 + Symfony2: Cast values before bind to DQL query

I'm building a function for filter some records based on four parameters: $codigo, $anno, $term and $comite_tecnico. This is what I build until now: public function filtrarNorma($codigo = null, $anno = null, $term = null, $comite_tecnico = null) { …
ReynierPM
  • 17,594
  • 53
  • 193
  • 363
1
vote
1 answer

An exception occurred while executing 'SELECT NEXTVAL('moneda_moneda_id_seq')':

im getting this error while trying to insert an entity in symfony2 with doctrine2, /** * Moneda * * @ORM\Table(name="moneda") * @ORM\Entity */ class Moneda { /** * @var integer * * @ORM\Column(name="moneda_id",…
metalvarez
  • 606
  • 1
  • 8
  • 14