phpdoctrine

Problem with var_dump PHPDoctrine Objects

Hi! I have a very strange problem, when I try to var_dump (or print_r) a PHPDoctrine Object, my Apache responses with an empty blank page (200 OK header). I can var_dump a normal php var like: $dummy = array("a" => 1, "b" =>2); And it works fine. But I can't with any object from any Doctrine class, (like a result from $connection->qu...

One-to-many relationship in the same table

Hi, Im trying to use to define a one-to-many relationship in a single table. For example lets say I have a Groups table with these entries: Group: Group_1: name: Atlantic Records Group_2: name: Capital Records Group_3: name: Gnarls Barkley Group_4: name: Death Cab For Cutie Group_5: name: Coldplay Group...

Doctrine_RawSql custom Select

I having problems to generate a doctrine_rawsql with a custom select. this is my rawsql $distance = glength(linestringfromwkb(linestring(asbinary(GeomFromText('POINT( FLOAT('30') FLOAT('-3')),asbinary({l.point})))) as distance $q->select($distance) ->from('place p INNER JOIN location l ON p.location_id = l.id') ...

Doctrine - filter by foreign agregate value

Hi there, how can i use result of Agregate function in where in Doctrine? For example i want to know user with silly much numbers. SELECT u.name, COUNT(p.id) AS users_phonenumber_count FROM users u INNER JOIN phonenumbers p ON p.user_id = u.id WHERE users_phonenumber_count > 10 GROUP BY u.id How can i access the *use...

Doctrine not Inserting Datetime in SQL Server

Doctrine ORM 1.0 inserts Datetime values in ISO8601 format; that is: '2009-10-23 12:31:22', but for some reason using SQL Server 2008 Express as my DB, throws an exception as if the value inserted was NULL. Here's the query: {sfDoctrineLogger} executeQuery : INSERT INTO [vbif_inventarios] ([anulado], [id_restaurante], [fecha_inventari...

Doctrine issues when using JOIN and WHERE

Hello all, I have a simple doctrine code: $dql = Doctrine_Query::create() ->select('u.ident, u.username, u.email') ->from('Users u, u.Attributes ua'); if ($query) { $dql->where('u.username LIKE ?', "%$query%") ->orWhere('u.name LIKE ?', "%$query%") ->orWhere('u.email LIKE ?', "%$query%"); } $dql->offset($start...

Doctrine many to many on same class

Hi, I'm trying to create a social-network like feature in an app I'm building, and Want to associate a Friend with another Friend. Assume I have this: Friend: connection: doctrine tableName: friend columns: id: type: integer(8) primary: true autoincrement: true name: type: string(75) notnull:...

Make doctrine load auto_increment value after save

I'm using Doctrine for database abstraction. Now I'd like to get the auto_increment primary key from the freshly-created (and save()'d) object - but $obj->toArray() shows me that the field is empty after calling save(). Is there a flag that I'm not aware of that does this? Or do I really have to query the object from the database? ...

What is the syntax for a multi-table delete on a MySQL database using Doctrine?

Using Doctrine, I am trying to delete records in a single table based on data gathered from multiple tables. 'companies_groups' is an association table linking 'companies' to 'groups'. I want to delete all records in this table linked to a specific company, with the restriction that only 'companies_groups' records linked to a 'public' g...

Mysql_insert_id with Doctrine

Hi! I have a couple of tables (mySQL) that i would like to update with the help of Doctrine. The products table id is auto-incrementing, and here's a brief description on what I would like to do: $prod = new Products(); $prod->type = '0'; $categ = new CategoriesToProducts(); $categ->cat = '111'; $categ->product = $...

Doctrine Update by DQL + field with parenthesis: "(" and ")"

Hello! I have a doctrine update query to save my data: $customer = Doctrine_Query::create() ->update('Customer') ->set('fax',"'". $this->getRequest()->getParam('fax')."'") ->where('id ='.$this->getRequest()->getParam('id')) ->execute(); The problem is that the field fax has parenthesis and doctrine returns an ...

DQL delete from multiple tables (doctrine)

Need to perform DQL delete from multple related tables. In SQL it is something like this: DELETE r1,r2 FROM ComRealty_objects r1, com_realty_objects_phones r2 WHERE r1.id IN (10,20) AND r2.id_object IN (10,20) I need to perform this statement using DQL, but I'm stuck on this :( <?php $dql = Doctrine_Query::create() ->del...

PHP-Doctrine2: Items - Shops - ItemsAtShops - how to conveniently implement using Doctrine2?

Hello. Somehow I can't figure out how to implement the following relations using Doctrine 2 syntax: I have Items and Shops. Each item has different price and different quantity at each shop. So, I have Items table, Shops table and ItemsAtShops table. How do I reflect the last one in Doctrine? I guess I need to create ItemsAtShops enti...

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...

Accessing Many-to-Many Field in Doctrine

This must be simple, but I can't seem to find the answer online nor figure it out through trial and error. I have a class Deck and a class Card which have a many to many relationship with each other. I'm fairly confident that I am adding Cards to Decks correctly (they are being written correctly into the DB, junction table and all), but...

Can I only generate base classes when calling Doctrine::generateModelsFromYaml()?

I am using Doctrine::generateModelsFromYaml(). It creates a directory filled with base classes. Cool. I'm guessing the point of separating the base classes is to store only column definitions and relationships (in other words, only things that can be gleamed from the DB. The extension models, on the other hand, will be edited with behavi...

Doctrine 2 Classloader weird behaviour - wrong paths to classes

Hi Guys, I'm having a bit of a problem with Classloader added to Doctrine 2 project. I have simple directory structure like this: config (bootstrap file) html (docroot with templates/images/js etc) php Entities (doctrine 2 entities) Responses (some transport objects) Services (processing api and business logic - like session beans in ...

PHP Doctrine - Best practice to set application-wide default table charset

At the moment, I am setting my table charset and collation like this: class Model extends Doctrine_Record { public function setTableDefinition() { //... $this->option('collate', 'utf8_unicode_ci'); $this->option('charset', 'utf8'); } } I am setting this in all my table definitions. Is there a way to set a default ...

Bundling Doctrine PHP commonly used models

Doctrine PHP documentation suggests bundling commonly used classes to single files. Does this refer to Doctrine model files? If so , do you have any examples of how this would be done and how you would then load those models? We are using lazy loading so I am curious about how the lazy loader would be able to find out where the various ...

report generation using zend + mssql server + doctrine ORM

Hi All, I want to create report (.csv) using Zend + Doctrine ORM + MS Sql Server. Can any help on this. Thanks in advance. Raja ...