doctrine

Installing sfJqueryTreeDoctrineManagerPlugin to Symfony 1.4

I have faced serious difficulties while installing sfJqueryTreeDoctrineManagerPlugin to Symfony 1.4 w/ Doctrine ORM. The installation directly from the server did not work out like with previous plugins that I have installed: C:\path>symfony plugin:install sfJqueryTreeDoctrineManagerPlugin plugin installing plugin "sfJqueryTreeD...

Doctrine findOneBy invalid field name where field does exist

I'm using Zend Framework with Doctrine. I'm creating an object, editing, then saving it. That works fine. However, when I later try to find that object based on one of the column values, Doctrine throws an error saying, "Message: Invalid field name to find by:". Notice there is no field name listed in the error message after the :. My ...

Can't call method in model table class using Doctrine with Zend Framework

I'm using Doctrine with Zend Framework. For my model, I'm using a base class, the regular class (which extends the base class), and a table class. In my table class, I've created a method which does a query for records with a specific value for one of the fields in my model. When I try and call this method from my controller, I get an e...

DQL Query fails

I've got 2 tables in an MySQL DB, im using doctrine 1.2 and symfony 1.4.4 Installedbase and Spare Installedbase: ib_id app_id location and Spare: spare_id app_id amount Now i want to join the to tables to show how many of the app are in the spare. e.g. $q = self::createQuery("l") ->select('i.*, s.*') ->from('InstalledBase i, Spa...

Memory leak in PHP with Symfony + Doctrine

I'm using PHP with the Symfony framework (with Doctrine as my ORM) to build a spider that crawls some sites. My problem is that the following code generates a memory leak: $q = $this -> createQuery('Product p'); if($store) { $q -> andWhere('p.store_id = ?', $store -> getId()) -> limit(1); } $q -> andWhere('p.name ...

Time based resource availability for events in mysql/php

For an event system I need to check if there are enough resources available for an event. Events have a a start and end timestamp, and needs a number of resources (for the sake of simplicity we'll assume that there is only 1 type of resource). When a new event is booked, there should be a check if it's possible. All events are doctrine-b...

What action is my Symfony/Doctrine generated form actually going to?

In my Symfony 1.4 project I am using the doctrine:generate-admin task to create the modules that compose my backend system. One such module is "journeys". When I view the source of the "journeys/new" page (which displays the form to create a new journey entity) the action of the form is simply "journeys" (I expected it to be "journeys/cr...

strange doctrine update problem

Hi, guys, I have a simple table like following: class SnookerCurrentInfo extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('current_frame_id', 'integer', 4, array('notnull' => 'false')); $this->hasColumn('current_player_id', 'integer', 4, array('notnull' => 'false')); $this->hasColum...

Preventing Doctrine from Dropping / Recreating Database When using build --all

The problem: I have a database that's running on a shared server. I do not have permission to drop/ create a database via the command line doctrine SQLSTATE[42000]: Syntax error or access violation: 1044 Access denied for user 'opnsrce'@'173.236.128.0/255.255.128.0' to database 'dev'. Failing Query: "DROP DATABASE dev" ...

Symfony and doctrine searchable sfDoctrinePager (symfony 1.4)

Can someone help me on paginating results with sfDoctrinePager? $articlesResults = Doctrine::getTable('Article') ->getTemplate('Doctrine_Template_I18n') ->getPlugin() ->getTable() ...

How to remove specific dql part in a doctrine Doctrine_RawSql query ?

i have read this http://stackoverflow.com/questions/1567652/doctrine-how-to-remove-part-of-a-where-clause-from-select-query-inside-listener but, i still cant see how to remove specific part, this is not explicitly written, can some one explain me how ? a sample of my Doctrine_RawSql $a = new Doctrine_RawSql(); $a->select...

Check if hydrated doctrine result is NULL

Hi, I'm trying to check if a result in my DQL is NULL. I got the following DQL query: $q = self::createQuery("l") ->select('i.*, s.aantal, m.naam, c.cat_naam, a.app_id') ->from('InstalledBase i, i.Spare s, i.Apparaat a, a.Categorie c, a.Merk m') ->execute(); return $q; Now i want to check if the s.aa...

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

When to use Doctrine_Table vs regular model class?

I'm trying to understand when is the appropriate time to use Doctine_Table classes and which methods to store there vs. in the regular model class file. Also, is it good practice to use the findBy* methods? ...

Doctrine - best way to check for a record, then either update or add

I've come across this scenario a few times in working on a current project. I have to see if a record exists then if it doesn't I need to add it, if it does then I need to update. What is the standard way of doing this with Doctrine? I seem to be querying to see if the record exists using a find* method. Then if that returns a positive ...

Where do DQL statements live in an application that is using Zend Framework and Doctrine

In an application that is using Zend Framework 1.10 and Doctrine 1.2, where should the DQL statements live if our application is built such that it has a Service Layer and a Gateway(aka Doctrine_Table) layer. It seems that our possibilities include: 1) Placing the DQL statements in the Service layer which seems to be a bit too high in ...

PHP: Doctrine: order joined records

Hi, I'm new to doctrine: I have a problem with the sorting of joined records. A sample. I've got an Article model which is associated with a Source model in 1 <-> n. The source model has a property called 'position' with an integer value. Now I want to fetch an article with it's sources orderes by the position. My DQL looks like this...

How to alter the auto_increment of a mysql-table using Doctrine

Hi, the question says it all it think :-) What is the best way to execute a query such as: ALTER TABLE tablename AUTO_INCREMENT = 1; using Doctrine? ...

Doctrine inserts when it should update

I am trying to use do the most simple update query but Doctrine issues an INSERT statement instead of an UPDATE. $q = Doctrine_Query::create() ->from('Image i') ->where('id = ?'); $image = $q->fetchOne($articleId, Doctrine_Core::HYDRATE_RECORD); $image->copyright = "some text"; $image->save(); I have a...

Multiple References in Doctrine Fixtures

I have following models: class User extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn ( 'username', 'string', 20 ); $this->hasColumn ( 'password', 'string', 40 ); $this->hasColumn ( 'salt', 'string', 40 ); $this->hasColumn ( 'email', 'string', 80 ); } public fu...