doctrine

Nested Set rollback in Doctrine

Hi, I'm importing some content into a Nested Tree model, and I'm implementing a Transaction to be sure each object has been saved; and if not, remove it from the tree. I'm using Doctrine 1.1.6. // Start the transaction $conn = Doctrine_Manager::connection(); try { $conn->beginTransaction(); // add it as a child of the suburb $ob...

Doctrine - all records are returned when there are no matches in Searchable behavior

I'm using the Searchable behavior in Doctrine to search for products in my catalog. It works great when searching for keywords that do match a product. For example, the keyword "Backpack" returns all products with the word "Backpack" in the title. However, when a search is done for a keyword that doesn't match a title at all then every...

Object-oriented Doctrine schema

Hey all, I'm learning Doctrine + Symfony and I may have chosen too complex a data model for my own good. Here's an overview: Users create Gizmos. There are 5 Modules to choose from. Users cannot define new ones, only instantiate them. A Gizmo has any number of Instances in any order. An Instance has one Module ID. Instances are config...

nesting conditions with DQL

Hey there :) Now that I've read all the DQL docs I still have some doubts, I'm trying to do some nested condictions in my DQL however playing around with DQL I can't seem to be able to archive them To make myself more clear: I have this DQL query $q = Doctrine_Query::create() ->select('c.nombre,c.webpage') ->addSe...

Can someone explain why the following DQL works?

$user = Doctrine_Core::getTable('User') ->createQuery('u') ->innerJoin('u.Profile p') ->where('p.username = ?', 'jwage') ->fetchOne(); It looks quite different from SQL which I'm quite used to,especially what does the u mean? Can someone make it clear by a decent explanation? ...

Doctrine can't find a connection after Zend Framework redirect

I have some troubles with Doctrine integration into ZF. After simple redirect $this->redirector->setGotoSimple("asd"); Doctrine returns Doctrine_Connection_Exception: There is no open connection in /Users/insight/Sites/max/library/Doctrine/Manager.php on line 657 if i try to get this "asd" page directly or press f5 at the err...

Doctrine expand extended model using column aggregation

Techniques: ORM, Doctrine 1.1.6, KohanaPHP With Doctrine 1.1.6. How do I spread a model over different tables? Detailed situation: I have the class Entity which contains an ID, login and password and has one emailaddress, many addresses and some other relations. I have two other classes, Company and Person, which extend Entity. I want...

How to implement this with NestedSet behavior in doctrine?

Task: columns: name: string(100) parent_id: integer relations: Parent: class: Task local: parent_id foreign: id foreignAlias: Subtasks ...

Where to save customized behavior for doctrine in a symfony1.4 project?

So that the behavior template can be autoloaded when necessary. I'm confused by the complex settings. ...

Why can't Doctrine retrieve my model data?

So, I'm trying to use Doctrine to retrieve some data. I have some basic code like this: $conn = Doctrine_Manager::connection(CONNECTION_STRING); $site = Doctrine_Core::getTable('Site')->find('00024'); echo $site->SiteName; However, this keeps throwing a SQL error that 'column siteid does not exist'. When I look at the exception the SQ...

What's the BNF of doctrine for?

It looks like a big mess,how does it work as reference? http://www.doctrine-project.org/documentation/manual/1_1/en/dql-doctrine-query-language%3Abnf ...

Doctrine wildcard WHERE query?

Hi, Is it possible to craft a wildcard WHERE query with Doctrine, like so: ->where('this_field = ?', ANYTHING); I'd be using this to build a search query dynamically out of unknown user-selected parameters and therefore would need to have the condition in place but capable of accepting the value "anything". To add, I can get this to...

How can I fetch the entire tree in a single query with doctrine?

This snippet from official website works as expected: $treeObject = Doctrine::getTable('Category')->getTree(); $rootColumnName = $treeObject->getAttribute('rootColumnName'); foreach ($treeObject->fetchRoots() as $root) { $options = array( 'root_id' => $root->$rootColumnName ); foreach($treeObject->fetchTree($options) as $no...

Symfony Doctrine Schema Segmentation Fault

Hi All, I'm setting up my first symfony project, and am having trouble with the schema. I'm not sure if I'm going about it the right way. I'm having a problem with two of my classes. I have Clients, which can have many Contacts, one of the contacts needs to be selected as the invoice contact. This is my schema: NativeClient: actAs: ...

Doctrine: Multiple (whereIn OR whereIn) query?

I'm having trouble crafting a fairly simple query with Doctrine... I have two arrays ($countries, $cities) and I need to check whether database record values would match any inside either. I'm looking for something like: ->whereIn('country', 'city', $countries, $cities) ... with 'country' being a WHERE IN for $countries and 'city' be...

Database migration from new YAML in Doctrine

I have to add a new column and a new table to my database but i dont have access to shell of my server. I changed my YAML file. How can i tell doctrine to "migrate models and database to changed yaml"? ...

Doctrine inheritance. Is there an easy way to get all child classes/tables for using them in a select field in symfony forms?

I just started to use symfony 1.4 and Doctrine. (Used 1.0 - 1.2 + Propel a lot before). I thought to give Doctrine a try, because of the fast and huge Development process in the past. Thanks to jwage ;-) Im using Table Inheritance. This is a small portion of my schema.yml: Articles: columns: id: type: integer(4) primary:...

PHPUnit Mock Objects and Static Methods

I am looking for the best way to go about testing the following static method (specifically using a Doctrine Model): class Model_User extends Doctrine_Record { public static function create($userData) { $newUser = new self(); $newUser->fromArray($userData); $newUser->save(); } } Ideally, I would use...

Copy a Doctrine object with all relations

I want to copy a record with all his relations. I'm trying with: $o = Doctrine::getTable('Table')->Find(x); $copy = $object->copy(); $relations = $o->getRelations(); foreach ($relations as $name => $relation) { $copy->$relation = $object->$relation->copy(); } $copy->save(); This code doesn't works, but I think it's on the way. ...

Symfony sfDoctrinePager with multiple tables

I was wondering how to get this to run. In my application I have a Category table and Product table. I need to have a pager which combines both Categories and Products for display in one list (first categories then products). Is there a way to get this going ? I tried left joining in the pager's query, but doesn't seem to do the trick. ...