doctrine

Doctrine generate-migrations-diff and migrate

Hi guys, I have tried to execute the cli command ./doctrine generate-migrations-diff and a version file has been created correctly in the right folder. The message is: generate-migrations-diff - Generated migration classes successfully from difference Then I try to execute another cli command ./doctrine migrate and a message appears t...

symfony 1.4: doctrine build model warning

Hi volks, I copied my sources from my lokal dev (everything works fine) to my repository and from there I did a checkout on my remote dev. Now when I try to build everything I get this error: devel:/var/www/myproject# ./symfony doc:build-model doctrine generating model classes file+ /tmp/doctrine_schem...

Doctrine 1.2 Column Naming Conventions for Many To Many Relationships

I'm working with an existing database schema, and trying to setup two Doctrine models with a Many to Many relationship, as described in this document When creating tables from scratch, I have no trouble getting this working. However, the existing join tables use a different naming convention that what's described in the Doctrine docume...

getTitle() on Doctrine i18n with non-default language

Hi, I'm having a problem getting the title of an object from my i18n object in Doctrine 1.1.6 / Symfony 1.2 I have the following Doctrine Table method: public function getPlace($place_id, $lang=''){ $q = Doctrine::getTable('Place') ->createQuery('p'); if($lang != '') $q = $q->leftJoin('p.Translation ptr') ->addWhere('ptr.lang...

How do I add values to a an array model in doctrine ?

Hi, I'm using Doctrine with Codeigniter, I defined my ratings column as $this->hasColumn('ratings','array', 1000);. I'm using $res = Doctrine::getTable('Resource')->find($resource_id); $res->ratings = $rating; $res->save(); but only the $rating gets inserted, overwriting the last value, I want to store the ratings as an...

How to format a join table form to display multiple checkboxes for values from one of the linked tables in Symfony?

Apologies if this is something really simple that I've missed. I have 3 tables and related forms in symfony 1.4 (using Doctrine) for a website for local tradesmen: Profile columns: name: { type: string(255), notnull: true} email: { type: string(255), notnull: true, unique: true } phonenumber: { type: string(255), notnull:...

generate-migrations-diff failing with Zend framework

I am trying to generate a migration script using Doctrine with Zend Framework. I am getting the following: $ php doctrine.php generate-migrations-diff $ PHP Fatal error: Cannot redeclare class Avo_Model_AccessType in $ tmp/fromprfx_doctrine_tmp_dirs/AccessType.php on line 16 I can successfully build the models form the yaml file. ...

All object properties are being saved, is it possible to only persist the fields that I've mapped?

I'm using Doctrine 2 ODM (with MongoDB). My Document model: class Users_Model_User { public $id; public $username; public $password; public $myRuntimeProperty = 'some value'; } My Document mapping in YAML: Users_Model_User: db: my_db collection: users fields: id: fieldName: id id: true usernam...

Perform some cleanup when deleting a record in Symfony/Doctrine

Using Symfony 1.4.5 with Doctrine I have a model which includes an uploaded image as one of the columns - creating and updating the record is fine (using the doSave() method to deal with the upload and any changes to the file). The problem I'm having is if the record is deleted - I want it to remove the associated file as well. But I c...

Issues with adding FK relations via Doctrine Build Task

I've double-checked my schema, and its correct... infact doctrine also built it once.. and now its troubling me with some FK relations... I have checked for the data-types as well. All are int(4) or int(2) 2 Qs here: 1. is there an upper limit to the no of relations (dependencies/FKs) a table can have? I have upto 7 FKs in a tables 2. i...

Doctrine Join DQL

I's like to do a join between 2 tables on a specific ID. At the moment, I have this DQL: $q = Doctrine_Query::create() ->select('e.*, i.itemName, i.itemtypeId') ->from('Model_EventItem e') ->leftJoin('Model_Item i ON e.itemId = i.itemId') ->where('e.eventitemId = ?', $event->eventId) ->orderB...

Get next birthdays using Doctrine

There's any way to get the next birthdays using only DQL (Doctrine Query Language)? I solve the problem using the SQL function DAYOFYEAR but I think that's not correct because that only work on MySQL and if I have to migrate to MSSQL (for example) that doesn't work. Thanks in advanced. ...

PHP Doctrine - Inherit foreign keys?

I have the following entities: User Admin : Inherits User Rules (relation: Rules * <-> 1 User) I can access $user['Rules'] to get a Doctrine collection for Rules. However $admin['Rules'] does not return anything. (No error either, normally a Unknown related component 'Rules' error would be thrown. Any help would be greatly appreciate...

What is the fastest way to count all the records of a table using Doctrine ORM?

Hi, The title says it all... What is the fastest way to count all the records of a table using Doctrine ORM? I don't need the individual records of the table. I just need the total number of records in the table. Thanks! ...

symfony fixtures: set ondelete: CASCADE on refclass table

Hi! I'm using symfony 1.4.5, Doctrine 1.2 and Mysql 5. In my schema.yml I have a few Many-to-Many relations which work great. But I need the joining table to have onDelete: CASCADE. Now for doctrine it is needed to add onDelete: CASCADE on the side where the foreignkey exists but since the refclass does not have any relations in the ...

[doctrine 1.x] Many to many relation on the same table

Hi! I'm trying to setup a m2m relation between 'Gabarits'. One gabarit can have many Gabarits ( called Options ) One gabarit can come from many Gabarits ( called OptionsFrom ) Here is my schema.yml: Gabarit: actAs: [Attachable] columns: libelle: { type: string, size: 255 } description: { type: clob } relations: O...

Use of URL Fields in Doctrine

I am building the site and planning on implementing OpenID. I can get an OpenID URL back from Google, but Doctrine appears to do funny things with URLs in the where clause of my query. How can I fix that? Here is the function /* This function queries docrtrine for a user OpenID URL * and returns the user object. */ function getUserBy...

Finding Groupwise Maximum In Doctrine

How do you find a groupwise maximum, or the row containing the maximum value, in Doctrine? In SQL, I would typically do this using a self join as described here. While it's possible to set up a self relation in Doctrine, are there any better ways to do this? ...

Does doctrine allow 2 models to use the same table

I have an abstract class User and 2 classes which inherit from it, namely BEUser and FEUser. Information about all users (FEUser and BEUser) is stored in a single table. Does Doctrine allows this kind of mapping? Any examples? Also if doctrine supports it which object does the table class return (FEUser or BEUser)? Thank You ...

One database, multiple customers

Hi all, I'm currently coding a product which will have only one database but will host many clients by using a global identifier of a customer_id. This is all very good. However, let's say we have a table called Ticket. Idea has a primary key. When a user adds a ticket, the ticket will correspond to the customer via a foreign key etc....