doctrine

Doctrine Many-to-Many relationship between three tables

Hello, I have three tables: note, user and tag. Following is the diagram of the relationship between those tables: User can have many Notes and Tags, Note can have many Users and Tags, Tag can have many Users and many Notes. I have no problem setting many-to-many relationship between two tables, but can't manage to relate three table...

problem understanding relation mapping in doctrine 2

I read official documentation and tons of threads but still do not find solution for my situation. My case is very basic. I have 2 entities: comments and keywords for them. One comment can have many keywords but each keyword is only for one comment. Keywords are not unique in keyword table. So i decided this is one-to-many relation. Tabl...

Doctrine schema changes while keeping data?

We're developing a Doctrine backed website using YAML to define our schema. Our schema changes regularly (including fk relations) so we need to do a lot of: Doctrine::generateModelsFromYaml(APPPATH . 'models/yaml', APPPATH . 'models', array('generateTableClasses' => true)); Doctrine::dropDatabases(); Doctrine::createDatabase...

Doctrine 2: How do i check if any result/object/row returned?

i wonder in doctrine 2, how do i check if the query returned any result. say if i use the following ... getXXXResult(); // eg. $result = $em->createQuery('xxx')->getXXXResult() findXXX(); // eg. $obj = $em->getRepository('xxx')->findXXX(); i wonder what other methods are there to query for data in doctrine and how i can check if t...

foreach returns more elements than count()

Hi, I'm using Symfony 1.2.7 and Doctrine 1.1. I have $activities (sfOutputEscaperIteratorDecorator - Doctrine_Collection). I'm escaping everything on settings.yml with ESC_SPECIALCHARS method. If I weren't escaping it, it would work without any problem, so I think the problem is related with sfOutputEscaperIteratorDecorator. If I do ec...

Doctrine creating columns with incorrect lengths

Hello. I have the following yml configuration for Doctrine under MySQL: Designer: tableName: designers columns: id: type: integer(2) name: type: string(30) notnull: true Item: tableName: items columns: id: type: integer(3) unsigned: true primary: true autoincrement: true ...

Database: Sorting hierarchical data (Modified Preorder Tree Traversal): How to retrieve immediate children

i am using MySQL with PHP & Doctrine 2. my question is assuming i am using Modified Preorder Tree Traversal is there a way i can retrieve only immediate children? ...

Doctrine RawSql strange error?

I really hope i'm overlooking here, but I really can't figure it out anymore. I'm at the point where copying a working piece of code to somewhere else makes it stop functioning... :( I have the following code which sets up a RawSql query for Doctrine, and outputs the sql query. I get some errors which I'm unable to resolve which I poste...

Any hierarchical Data Support in Doctrine 2?

in Doctrine 1, i see that it supports hierarchical data support? is there any in Doctrine 2? UPDATE 1 ok so i used Nested Set Extension for Doctrine 2. i have some questions 1. inserting a node // in the docs $child1 = new Category(); $child1->name = 'Child Category 1'; $child2 = new Category(); $child2->name = 'Child Category 2'; ...

Form : sfWidgetFormDoctrineChoice, choose the method

Hello, In my form I want to use a widget Doctrine, but I can't change the method use to display the result of the doctrine query. I have make a function in my model : public function quartiers() { return $this->getQuartier(); } And in MyClassForm : $this->widgetSchema['list_quartiers'] = new sfWidgetFormDoctrineChoice(array('mode...

How to make ghost fields in Doctrine?

Hello. I have such a model Designer: tableName: designers actAs: I18n: fields: [name] columns: id: type: integer(2) unsigned: true primary: true autoincrement: true name: type: string(30) notnull: true While default I18n behavior must be used like this $d = Doctrine_Query::c...

Difference between the results of Doctrine_Query and Doctrine_RawSql

Hey I have problem with the following Doctrine_RawSql: public function getWithThreads($forum_id) { $conn = Doctrine_Manager::connection(); $q = new Doctrine_RawSql($conn); $q->select('{f.*},{t.*}, {p.id}, {p.last_post_date} ') ->from(sprintf("forum f LEFT JOIN thread t ON t.forum_id = f.id JOIN (SELECT MAX(p.crea...

Writing model methods in Doctrine

Hello! I'd like to encapsulate functionality specific to certain models by including methods in the model class definitions. So, for example: abstract class BaseUser extends DoctrineRecord { public function setTableDefinition(){ //etc. } public function setUp(){ //etc. } public functio...

Doctrine: How could I get all participants of many-to-many relationships

I have 3 table: ["Order", "Order_to_goods", "Goods"] I want to get of all participants of many-to-many relationships, by Order_ID, to can do something like that: $Order = Doctrine::getTable('Order')->findOneById( 1 ); $Order ->loadReleated('Goods'); foreach( $Order->Goods as $product){...} But it isn't work. Having tried everything ...

How do i manage M:N Post-Tag relationship (eg. Edit/Delete)

its when i starting trying implementing this that i got quite stuck. some business rules 1 Post can have many Tags. 1 Tag can have many Posts the database will look like. Posts (id, title, body, ...) Posts_Tags (post, tag) Tags (id, tag, ...) when i insert - straightforward tags will come from user input as comma separated val...

Convert from Database / Excel / CSV to YAML data fixtures?

Was wondering if there is an easy to convert structured files into YAML data fixtures for Doctrine / Symfony. I don't see any utility with Doctrine to accept CSV. I might just start writing something simple to do this. Is it worthwhile? ...

Doctrine Override Getters and Setters for Relation fields

Hi, Does anyone know how to override Doctrine_Record getters and setters for Relation fields. For example if I have a class Note, Note has many Users, now can I override, for example, this operation Note->Users[] = $user1 ? Thanks! ...

Auto iconv of Doctrine query

How do I set up Doctrine to automatically run iconv (Windows-1251 to Utf-8) when fetching data? ...

Is this the right way of integrating Zend Framework with Doctrine 2?

i seem to managed to integrate Doctrine 2's autoloaders to Zend's, tho i am not sure if i am doing it correctly ... directory structure /application /models /User.php // following classes are doctrine models /Post.php /Tag.php /proxies /... // proxy classes generated by doctrine /.....

Doctrine 2: default value

am i missing something? how do i set default value in doctrine 2? ...