doctrine

How Does Doctrine Maintain Record References?

When Doctrine hydrates Records, it does so in a way that all instances to a record are the same. Here's an example: $p = ProfileTable::getInstance()->findOneBy('id', 5); $q = ProfileTable::getInstance()->findOneBy('id', 5); echo 'P before: ' . $p->name . "\n"; echo 'Q before: ' . $q->name . "\n"; $p->name = 'Sam'; echo 'P after: ' . $p-...

Doctrine Class Inheritance in XML

I'm trying to setup class inheritance using the Doctrine 2 ORM, but am getting errors (even when following their examples). I'm using the console from a Symfony 2 sandbox. The simple example uses the classes Person and Employee; An Employee extends Person. The error I'm getting when trying to generate the entities is: [Doctrine\ORM\M...

PHP Symfony Doctrine - How/where to enable DQL Callbacks?

http://www.doctrine-project.org/documentation/manual/1_0/ru/behaviors:core-behaviors:softdelete You are required to enable DQL callbacks in order for all executed queries to have the dql callbacks executed on them. In the SoftDelete behavior they are used to filter the select statements to exclude all records where the deleted_at fla...

How to create basic pages with Symfony and Doctrine

Hello, I'm completely new with Symfony and Doctrine. I have generated a project with a the Doctrine ORM, my database schema is fully well generated. Now I just want to create basic services (in simple .php pages) that do some actions according to parameters in a HTTP POST request. I tried to create an app through the generate:app comma...

CodeIgniter and Doctrine: Base table or view not found

I'm following the documentation almost word for word, except for two adjustments which I believe are corrections. First adjustment: I eliminate the redundant DIRECTORY_SEPARATOR in system/application/doctrine.php: //this produces "...system/application//fixtures" $config = array('data_fixtures_path' => dirname(__FILE__) . DIRECTORY_S...

Doctrine: 1 to many relationship with multiple foreign keys

Hi, I am using Doctrine 1.2 and looking for the correct syntax for creating a 1:n relationship between two tables in my schema.yml Usual this is done by: BookChapter: columns: ... relations: Book: class: Book local: book_id foreign: id type: one onDelete: cascade However in my special case t...

SQL / Doctrine : Left Join problem

Hello, Currently this function works : it displays for a specific game, how many jobs there are. The problem : If there is no job, the game does not appear on the list. How to display the game even if there is no job attached ? Thanks public function getWithGames() { $q = $this->createQuery('c') ->leftJoin...

symfony 1.4.8+ doctrine --> doctrine:build-schema fatal error opening required /tmp/tmp_doctrine/User.php

I'm trying out symfony so i started installing it on a remote mashine thru ssh (normal user, no root access) when getting to the part where i want to generate the db-schema out of a existing mysql database with doctrine by issuing the following command: ./symfony doctrine:build-schema i get the following errors: Warning: require_on...

tar: Error is not recoverable: exiting now

Hello, when I untar doctrine -rw-r--r-- 1 root root 660252 2010-10-16 23:06 Doctrine-1.2.0.tgz I always get this error messages root@X100e:/usr/local/lib/Doctrine/stable# tar -xvzf Doctrine-1.2.0.tgz . . . Doctrine-1.2.0/tests/ViewTestCase.php Doctrine-1.2.0/CHANGELOG gzip: stdin: decompression OK, trailing garbage ignored Doctri...

CodeIgniter + Doctrine: CRUD in Controller?

Hi all, I am a newbie to MVC, CodeIgniter and Doctrine, so maybe my question is not that relevant. Pardon me if thats the case. I've been reading the CodeIgniter + Doctrine tutorials on PHPandStuff.com. I really like whatever I have seen of Doctrine and wish to use it for my project. However, since all database related operations shoul...

Doctrine 1.2: Adding validation method to record template

In a Doctrine Record object, I can add the following method to validate data: protected function validate() { if (empty($this->first_name) && empty($this->last_name) && empty($this->company)) { $this->getErrorStack()->add('company', 'You must fill in at least one of the following: First Name, Last Name, Company'); } } ...

Hibernate Envers for Doctrine?

Doctrine 1.x and 2 both offer some kind of Versionable support in the form of a separate auditing table that tracks changes over time. However, the versions appear to be intended for per-row use (ie, they all maintain their own version number) instead of database-wide, such as in Hibernate Envers, which gives every row a unique revision ...

Fatal Error when using Doctrine ORM with Zend Framework

I am having a little play with an ORM but I am struggling to get off the starting blocks. I am familiar with Zend_Db and was hoping Doctrine would work in a similar way but with more flexibility. I've followed the various tutorials, to integrate Doctrine with Zend Framework, which are available. All these tutorials more or less say the ...

Checking for duplacte keys with doctrine 2

Hi all, Is there an easy way to check for duplicate keys with Doctrine 2 before doing a flush? ...

PHPs Doctrine creates empty records.

I played a lot with Doctrine 1.2. Creating and deleting records are no problem anymore ;). But sometimes i have empty records in my database. Every field is set to NULL. I have the feeling it has something to do with relations. How can i prevent Doctrine of creating such empty entries. ...

[Smarty, and maybe doctrine]

Hi everyone, I'hv got a problem when I am using foreach in smarty, an array with 2 item was loop in a foreach, but the result is it loop 3 time. I use doctrine to get a list of review by a user from database Doctrine_Core::getTable('review')->findByUser($userId); then I assign it to smarty and loop in foreach: {foreach from=$r...

Good comparison Doctrine vs Propel

Hi! I've seen plenty of comparisons of Doctrine vs Propel, but none of them has actually convinced me to choose Doctrine over Propel. I've been using Propel for a while now and almost every comparison I read states that Propel is not well documented as the first problem and I've read Propel's docs and they're quite well. Also, most of...

binding a doctrine_record class to a query result

I just started out with Doctrine and it has been awesome so far. I have a little challenge though. class TestTable extends Doctrine_Table { public function getRecent() { return $this->createQuery('Test')->execute(); } } class Test extends Doctrine_Record { public function setTableDefinition...

MVC + ORM, generating reports

I've just started using Zend Framework and Doctrine as its ORM, and I have some doubts regarding the model. It's obvious that the purpose of the ORM is just to map my domain model to database model, but I'm curious how you would model various reports needed on a Web application? From my point of view, and correct me if I'm wrong, I shou...

problem understanding record mapping in doctrine 1.2

I have about 10 fields in my table but I cant doctrine doesnt seem to get two fields, the title and description field...I am confused ...