doctrine

How to self-initialize Doctrine_Record (as if Doctrine_Query would)?

Hi, I have models that extend Doctrine_Record, and are directly mapped to one specific record from the database (that is, one record with given a given id, hardcoded statically in the class). Now, I want the specific record class to initialize itself as if Doctrine_Query would. So, this would be the normal procedure: $query = new Doct...

The module "taggableComplete" is not enabled

I'm trying to add the tag widget from the plugin sfDoctrineActAsTaggablePlugin I've added "_tag" to my configuration.yml, and in _tag.php I wrote : <?php include_component('taggableComplete','tagWidget', array('object' => $form->getObject())) ?> But all I get now is the following error : "The module "taggableComplete" is not en...

How to Generate Models using doctrine1.2 in an existing db with PHP ?

Hi, can someone please tell/type here how to generate models from an existing DB using php and doctrine ?, what i did was, I placed the Doctrine folder + Doctrine.php inside a folder named e.g test , now within that test folder I added a php script named test1.php, and within that test1.php , here's the code that I used include_once('D...

Doctrine - encryption with dql listeners

I am attempting to encrypt certain database fields by adding a call to mysql AES_ENCRYPT (and AES_DECRYPT) using Doctrine DQL Hooks. for SQL SELECT's I have a preDqlSelect() in my Doctrine_Record_Listener class, which goes through each parameter in the select fields, and adds a AES_DECRYPT() for encrypted fields. But, it looks like ca...

Migrating from MySQL > PostgreSQL (PHP/Doctrine)

I have a system with 25 tables. I ran a utility to basically get all my data to a postgres table, but now I'm getting a lot of errors in the front end of my website after I switched the db driver. How can I go about completely migrating my current PHP/Doctrine MySQL system to work with Postgres? ...

Doctrine and join order (root class must have at least one field selecteD)

Hello, I have the following Doctrine query: Doctrine_Query::create()->select('td.*')->from('Model_Transaction t')->innerJoin('t.details td on td.fieldName = ?', 'CALLER_NUMBER')->fetchOne() The "details" relation is defined like this, in the Model_Transaction_Abstract class: $this->hasMany('Model_TransactionDetail as details', array...

Doctrine: Complex JOIN problem

I have many-2-many relation between Property and Feature. I have to extract results from Property table, but only if both or more Features are related. Ie. Property #1 is related to 'Swimming Pool' and 'Garden'. Property #2 is related only to 'Swimming Pool'. So when I ask for properties that has both 'Swimming Pool' and 'Garden', it sh...

Propel as a Standalone Library

I want to use Propel as a Standalone Library just as Qcodo or Doctrine e.g. without using Pear or Phing. I want to run both the generator and runtime in a Phing Free and Pear Free Environment. Is that Possible ? ...

Is it good practice to make static find methods in Doctrine models

Sometimes I have complicated find procedures and I'm feeling dirty to repeat this code in my Controller. Now I am thinking, it is possible to do something like this: class User extends BaseUser { private static function getTable() { return Doctrine_Core::getTable('User'); } public static function findAll() ...

What's "wrong" with my DQL query?

I have the following SQL query: select bank.* from bank join branch on branch.bank_id = bank.id join account a on a.branch_id = branch.id join import i on a.import_id = i.id It returns exactly what I expect. Now consider the following two DQL queries: $q = Doctrine_Query::create() ->select('Bank.*') ->from('Ban...

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

Doctrine 2: group by field alias (Error: '...' does not point to a Class. )

I got this Doctrine query: select upper(substring(e.name, 1, 1)) first_letter from Application\Models\Exercise e group by first_letter order by first_letter asc But it throws an exception with the message: Error: 'first_letter' does not point to a Class. If I leave out the group by and the order by,...

Doctrine : Lazy loading properties

It looks like when I forget to put leftJoin in my queries, Doctrine will lazy-load relations after I pick them. Ie if I do something like: $property = PropertyTable::getInstance()->createQuery('o') ->leftJoin('o.Features f') ->execute() ; I will still be able to access $property->Attraction , even if I didn't load them in this que...

Symfony Doctrine skeleton files

I'm using Symfony 1.4 with the Doctrine 1.2 plugin. I would like to add some function to the Doctrine auto-generated models files (*Base.class.php). Thoses file are normally generated using "./symfony doctrine:build-model" command from the CLI. I know Symfony have a system of skeleton for every file generated from the CLI but I habe abs...

Dynamic table names in Doctrine

If I have tables in doctrine for user_1, user_2, etc. is there a way to dynamically set the table name in Doctrine for a single User model? It's weird, I know. I'm trying to create an interface to a WordPress database (because WP has little to no API for directly accessing posts), and WP creates duplicate tables for each site, so there'...

Doctrine Self Referencing is not working in Symfony 1.4 when updating or deleting

Hi there! I'm trying to build a model for content pages on my site, and i gave it a self reference named 'Related Page'. Now if i build my models and try to create a new page in the admin generator everything works fine. If i give the page a related page (or more) it works fine too, but if i go to the other page and try to edit the refe...

[doctrine] Strange problem when using HAVING() and Doctrine_Pager

My program generates this DQL using echo $q->getDql(); reformated for easier reading: SELECT o.*, t.*, COUNT(t.id) AS num_of_reservations FROM Property o LEFT JOIN o.Reservation t WITH t.status=? AND ( (t.start_date<=? AND t.end_date>=?) OR (t.start_date>=? AND t.start_date <= ?) ) GROUP BY o.id HAVING num_of_reservations <...

Strange Doctrine behaviour with double innerJoin()

Hello, I have a database schema like this: My database schema: http://i.imgur.com/vFKRk.png To explain the context: One user writes one message. He can send it to one or more users. I succeeded to get the title of message, the author for one user. However Doctrine, which I use for this project, do it with 2 queries. It's a little bi...

Indexing previous records with Doctrine (and Symfony!) with Zend Lucene

I have a Symfony application that uses Doctrine as its ORM. Based on Symfony's "Practical symfony" book, I have Zend Lucene added to my web app. However, the problem is that there are around 1.1 million rows existing in the database that I want to index for Lucene as well. The only things being indexed are edited rows and the rows have...

Symfony 1.4 / Doctrine 1.2 - Converting module to a plug-in - Model behaviour weirdness.

Okay, please try to follow closely to understood the problem, it weird, I know. I'm converting a working module to plug-in and did run to weird problem. Here is the schema.yml Code: Categories: actAs: I18n: fields: [ name, description ] Timestampable: NestedSet: columns: na...