doctrine

Using Doctrine with Domain Driven Design

I'm thinking of implementing a Domain Driven Design approach (similar to the one described here), but want to integrate it with the Doctrine ORM. Has anyone had any success doing anything like this? My initial instinct was to use Doctrine as the DAO layer, but it seems a a bit convoluted for Doctrine to map my database fields, and my en...

Filters in Doctrine

nHibernate has a great feature called filters, so i can create criterias globally for my applications. I'm starting a project in PHP and i need to use an ORM, i'd like to know if Doctrine has a similar feature to manage query conditions. thanks ...

Write/get data from joining table in many-many relation

Hi, is there a way to get or write data to/from joining table in many to many relation? I have two tables joined by third. Question one: How can i GET data from the joining(middle) table, when i'm retrieving data in similar query //table1 is "root" table - containing records related to table3 //table2 is joining/cross table //table3 c...

PHP Doctrine SoftDelete - Include deleted records?

If I have one of my PHP Doctrine objects act as a SoftDelete, is it possible to include deleted items in the results of certain queries? What I'm looking for is something like this... $q = Doctrine_Query::create() ->select('*') ->from('Test t') ->where('id < ?', 25) *->includeDeleted()*; Something like this would be u...

Opcode (APC/XCache), Zend, Doctrine, and Autoloaders

I am trying to use either APC or XCache as an opcode to cache my php pages. I am using it with Zend and Doctrine and it's having a problem with the autoloader. If I try with APC, I get the following: Fatal error: spl_autoload() [<a href='function.spl-autoload'>function.spl-autoload</a>]: Class Doctrine_Event could not be loaded in ...

Finding extra columns in a many to many relationship table

I wish to persist some extra data in a many-to-many relationship by having some extra fields in the association table. For instance, I would like to keep track of what role a user has in a network, such as 'member', 'moderator', 'admin' etc. I would also like to keep track of when he/she joined the network. Now, what I am looking for is ...

Fetching categories and items with Zend Framework

Hi all, Currently my code below works fine but it's a bit of overkill. In my controller I fetch the categories that have links and all the links in my database. In my view I loop through all the categories and then when I want to add the links under the category I loop through all the links in my database instead I should only loop thro...

How do I remove a self referencing n:n relation in Doctrine?

I'd like to represent e friend relationship between two users in Doctrine. I am able to create the relationship, but I don't know what's the best way to delete it. I have the following schema: User: columns: name: string(255) relations: Friends: class: User local: user1 foreign: user2 refClass: Frien...

How to use Doctrine_RawSql for a fulltext search and sorting by relevance

I'm trying to get fulltext searches to be sorted by relevance in a Doctrine_RawSql query. This code will perform the search: $q = new Doctrine_RawSql(); $q->select('{p.*}') ->from('cms_page p') ->where('match(p.content) against (?)', $user_query) ->addComponent('p', 'CmsPage p'); This will execute. I would like the results to ...

Zend_Validate: Db_NoRecordExists with Doctrine

Hey there, I'm trying to validate a form with Zend_Validate and Zend_Form. My element: $this->addElement('text', 'username', array( 'validators' => array( array( 'validator' => 'Db_NoRecordExists', 'options' => array('user','username') ) ) )); For I use Doctrine to handle my databas...

unit testing with symfony + doctrine + PHPUnit

I'm working with Symfony + Doctrine + PHPUnit, with NetBeans IDE. Here' my current approach to unit testing. setUp() function loads the test fixtures from .yml files tearDown() function delete all data from models. this is done by looping through an array of all my models' names to something like Doctrine_Query::delete($modelName)->exe...

Doctrine ORM: drop all tables without dropping database

i have to work with an existing database (not managed with doctrine) and i want to use doctrine only for new tables in this db. is there a way to tell doctrine to not drop the entire db on reload but only the models defined in the yaml file ? ...

Doctrine query memory usage

Doctrine appears to be taking well over 4MB of RAM to execute a single, simple query: print memory_get_peak_usage()." <br>\n"; $q = Doctrine_Query::create() ->from('Directories d') ->where('d.DIRECTORY_ID = ?', 5); $dir = $q->fetchOne(); print $dir['name']." ".$dir['description']."<br>\n"; print memory_get_peak_usage()." <br>\...

Doctrine: Set model values as array

Hi, I've got an array of values I want to update my model with. Doctrine_Access provides a function setArray which is nearly exactly what I need - except it cares about values that don't have fields in the model. I want those to be ignored. A little example. Say we have a User table with the field username. $user = new User(); $user-...

Doctrine - own postgres function

Hi, how can i call my own function stored in postgres DB, while i am selecting data throught Doctrine_Query::create() ->select('schema.my_function(id)') ...

How do i detach a behavior in Symfony/Doctrine?

Hi, I have doctrine's softdelete behavior attached to all of my models. Is there a way I can hard delete a particular record? In cakephp I remember detaching the behavior... deleting the record and then re attaching the behavior. Is there something similar in symfony/doctrine ? If so then how do I detach a behavior? Cheers ...

What is the best MVC, Doctrine2, Datamapper practice?

I am looking into using Doctrine2 with my Zend Framework setup. I really like the datamapper pattern, mainly because it seperates my domain models with my database. My question is what is the best practice for using Doctrine and DQL with my controllers? controllers uses Doctrine DQL/EntityManager directly for saving/loading my domain ...

In symfony/doctrine's schema.yml, where should I put onDelete: CASCADE for a many-to-many relationship?

I have a many-to-many relationship defined in my Symfony (using doctrine) project between Orders and Upgrades (an Order can be associated with zero or more Upgrades, and an Upgrade can apply to zero or more Orders). # schema.yml Order: columns: order_id: {...} relations: Upgrades: class: Upgrade local: order_id ...

How to keep two development databases in sync with Doctrine?

(Make this CW if needed) We are two developers working on a web application based (PHP5, ZF, Doctrine, MySQL5). We are working each with a local webserver and a local database. The database schema is defined in a YAML file. What's the best way to keep our database schemas in sync? Here's how we do it: Whenever developer "A" makes a ch...

Doctrine ORM: Models not respecting case

I have a mysql database table called UserDegree, when i try to import back to PHP using Doctrine it generates a model name Userdegree, is there a way to solve this? i really can't find any good doctrine documentation. thanks! ...