doctrine

Doctrine : many to many with a date of assignation in the refclass

residentSector: columns: id_resident_sector: type: integer primary: true autoincrement: true id_resident: type: integer(8) id: type: integer(8) date: type: timestamp residents: c...

How to check the existance of multiple IDs with a single query

Hey there I'm trying to find a way to check if some IDs are already in the DB, if an ID is already in the DB I'd naturally try to avoid processing the row it represents Right now I'm doing a single query to check for the ID, but I think this is too expensive in time because if I'm checking 20 id's the script is taking up to 30 seconds ...

Doctrine does not export relation properly

Hi, I've got a MySQL 5.1.41 database which i'm trying to fill with doctrine, but doctrine does not insert the relations correctly. My YAML is: Locatie: connection: doctrine tableName: locatie columns: loc_id: type: integer(4) fixed: false unsigned: false primary: true autoincrement: true org_id: type: i...

Problem with sfRemember cookie / sfGuard Remember me

I'm using Symfony 1.4 with Doctrine. Sorry if this is a silly question but what exactly does one need to build on top of the sfDoctrineGuardPlugin to get the "remember me" functionality working? When I login a user, the sfRemember cookie is created with the default 15-day lifetime, and the remember key is saved in the plugin's sf_guard...

how to acess user session in sfDoctrineRoute with symfony ?

how to acess user session in sfDoctrineRoute with symfony ? var_dump(sfContext::getInstance()->getUser()); returns NULL i cant access current user session in routing http://stackoverflow.com/questions/2455817/symfony-accessing-user-session-from-a-custom-routing-class = bad response ...

sfValidatorAnd fails when saving a i18n object

Hi, I'm using Symfony 1.2 with Doctrine. I have an object with the i18n behaviour. If I have the following validators, it fails when saving the form with error "SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'id' cannot be null" (it tries to save the object_translation before saving the object) $this->validatorSchema['pho...

Symfony file upload - "Array" stored in database instead of the actual filename

I'm using Symfony 1.4.4 and Doctrine and I need to upload an image on the server. I've done that hundreds of times without any problem but this time something weird happens : instead of the filename being stored in the database, I find the string "Array". Here's what I'm doing: In my Form: $this->useFields(array('filename')); $this->...

sfDoctrineGuard - how to ALWAYS join sfGuardProfile to sfGuardUser

I want to make it so that anytime the db is queried for an sfGuardUserProfile it is autmoatically joined and hydrated with its related sfGuardUser. If i was using Propel 1.2 i would normally override the doSelectStmt method of the sfGuardUserProfilePeer class to inspect the Criteria and modify it as necessary as well as modifying the hy...

Symfony forms: Is there any way to set default date for created_at and updated_at field

Hi all, I have a symfony form which have created_at and updated_at field for date. But I want to populate this field with default value and not shown when the form shows. So that, the created_at will hold the current time when inserting new data and updated_at will hold current date when updating any data. Did anyone do something like th...

Subquery Doctrine Couldn't find class

I'm trying to create a query like this one : $q = Doctrine_Query::create() ->select('p.nombre') ->addSelect('(select count(*) from alojamiento a left join localidad l on a.localidad_id=l.id where p.id=l.provincia_id and a.activo=true)') ->from('provinc...

Doctrine SQL Server uniqueidentifier isn't cast as char or nvarchar when retrieved from the database.

When I retrieve a record from the database which has a column of type "uniqueidentifier", Doctrine fills it with "null" rather than the unique id from the database. Some research and testing has brought this down to a PDO/dblib driver issue. When directly querying via PDO, null is returned in place of the unique id. For reference, htt...

When hydrating a doctrine record manually, call to Doctrine_Record->exists() returns false, when it actually does exist. Options

When I manually hydrate or synchronize a record (for legacy integration reasons) and call ->exists() on the instance, it returns false. However, this record actually does exist. Is there some way to make Doctrine tell us the truth without having to execute another query? ...

accessor and mutator?

when using doctrine i stumble upon these 2 words: accessor and mutator. are these only used in doctrine or are they specific for php? and what do they mean? thanks ...

What is the best way to convert a doctrine nested set to an li-structure?

Hi, I'm using Doctrine NestedSet behavior. I'd like to render the tree using php to <ul>'s and <li>'s Here's an example of what the output might be: <ul> <li>Node 1</li> <li>Node 2 <ul> <li>Child 1 of Node 2</li> <li>Child 2 of Node 2 <ul> <li>Another Child</li> ...

Symfony and Doctrine 1.2.2: How can i get the SQL clause of a Doctrine_Query object?

Hi, i have this code: $this->lista_miembros = $this->filtro->buildQuery($valores_query); var_dump($this->lista_miembros); var_dump outputs a Doctrine_Query object: object(Doctrine_Query)[121] protected '_subqueryAliases' => array I tried getSql() ... $q = Doctrine_Query::create() ->select('u.id') ->from('U...

symfony + doctrine + inheritance, how to make them work?

I am beginning to work with Symfony, I've found some documentation about inheritance. But also found this discouraging article, which make me doubt if Doctrine handles inheritance any good at all... Has anyone find a smart solution for inheritance in Symfony+Doctrine? As an example, I have already structured the database something lik...

Using Raw SQL with Doctrine

I have some extremely complex queries that I need to use to generate a report in my application. I'm using symfony as my framework and doctrine as my ORM. My question is this: What is the best way to pass in highly-complex sql queries directly to Doctrine without converting them to the Doctrine Query Language? I've been reading about ...

symfony: boolean columns not rendering checkbox widgets as checked

Using Doctrine in symfony 1.4 I have several boolean columns defined (stored as a tinyint in mySQL). The checkbox widgets are always rendering as checked, even when the returned value is '0'. It seems related to this ticket. Is this a common problem? Is there a workaround? I can get it working by changing line 70 in sfWidgetFormInputCh...

How can I merge two Doctrine records without null values overwriting existing values?

I have an array of default values that I'd like to merge with a Doctrine record. I tried using Doctrine's merge method but it's overwriting existing values with the merge array, even if the merge array contains null values. I'd like to merge in a way that only null or empty values are replaced with existing default values. ...

how to check if entity already exists in database before inserting in doctrine?

whenever i insert a entity that already exists in database (i have a unique constraint on email) i get an error message on the screen. so i want to check if it already exists, if not i insert it. at the moment it looks like this: $q = Doctrine_Query::create() ->from('User u') ->where('u.email = ?', $email); $object = $q->fetc...