doctrine

Is the method Doctrine_Table::find() deprecated?

Hi, I had a problem with the method Doctrine_Table::find(), since it's thorowing an exception of SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens I solved the problem by using Doctrine::getTable('City')->findOneById($id); instead and it works fine. When I tried to invistigate about t...

Sorting List of Articles in Symfony

Hey All! So I am somewhat new to symfony but am getting better by the day thanks to the symfony websites and stackoverflow! So, I have a module called articles, where I display a list of articles the I uploaded. On the index, its just lists all of the article. BUt i was wondering how I could make it so that if I click on the author, for...

Routing Problem With Symfony

So I have a module that displays articles. And I tried to make an action that displayed all article of a certain publication when that publication was clicked. I tried following the way to do this on the symfony jobeet tutorials but I ran into some new headaches. Since publications and authors can sometime be url unfriendly, I want to us...

How do you override a Constant in Doctrine's Models?

In Doctrine you are provided with a Constant Variable that allows you to set a global Identifier column in all of the models that are generated by Doctrine's code. I am trying to figure out how I can override/shut off this value so that it does not create this column in a specific table. The Constant is: ATTR_DEFAULT_IDENTIFIER_OPTION...

Issue with the doctrine-cli

I am having issues getting my database to build from my YAML file. Here is the error: ./scripts/doctrine-cli build-all-load build-all-load - Generated models successfully from YAML schema build-all-load - Couldn't locate driver named mysql build-all-load - Created tables successfully build-all-load - Data was successfully loaded It b...

findByExample in Doctrine

Hi, Is there a method in doctrine like hibernate findByExample method? thanks ...

PHP Doctrine 1.2 table names

I'm trying to upgrade my doctrine ORM from 1.1.6 to 1.2.1 but i've enountered a BC issue with table names. Some of my table names have several words (e.g. t_foo_bar for class FooBar) where the t_ prefix is generated automatically with: $manager->setAttribute(Doctrine_Core::ATTR_TBLNAME_FORMAT, 't_%s'); This worked well in previous ve...

Doctrine-CLI database creation issue.

I have Doctrine setup in my Zend Framework application and I built my schema YAML file. But when I tell Doctrine to build the tables it says it does but it doesn't actually make them. It creates the models, and will create the DB but it will not populate the DB with the tables and throws no errors. Does anyone have a guess or know why th...

Doctrine listener - run action only if a field has changed

How do I check if field has changed? I'd like to trigger an action in preSave() only if specific field has changed, e.q. public function preSave() { if ($bodyBefore != $bodyNow) { $this->html = $this->_htmlify($bodyNow); } } The question is how to get this $bodyBefore and $bodyNow :) ...

PHP ORMs: Doctrine vs. Propel

Hi, I'm starting a new project with symfony which is readily integrated with Doctrine and Propel, but I of course need to make a choice.... I was wondering if more experienced people out there have general pros and/or cons for going with either of these two? Thanks a lot. EDIT: Thanks for the all the responses, useful stuff. There's n...

Using Zend Framework and Doctrine with independend modular structures

I've seen a lot of articles about integrating ZF and Doctrine. There is also a proposal for ZF here but they have always two possible structures. Either they put all models into one top level model directory or they put it into a module related model directory. application |-- Bootstrap.php |-- configs |-- controllers |-- models ...

How to set the default hydrator in Doctrine?

I can't find a way to set the default hydrator in Doctrine. It should be available. Right? http://www.doctrine-project.org/documentation/manual/1_2/en/data-hydrators#writing-hydration-method The above documentation page explains how to create a custom hydrator. The drawback here is that you need to "specify" the hydrator each and every...

Symfony admin generator: Filtering the display columns

Hi, I am making use of the admin generator in Symfony 1.4, which is 99% working as I want it to simply using the options in the generator.yml config file. The problem I have is that I wish to specify which columns are displayed in the list view using a filter (as opposed to configuring them in generator.yml). I have successfully creat...

Column-level UTF-8 in Doctrine

Does Doctrine support setting individual columns to charset UTF8? Documentation seems to refer to table-level only. Please advise. Thanks. ...

Problem with getting ID after inserting a record that has relation in Doctrine

Problem was solved check my answer Hi, I'm having a trouble with getting the id after inserting a new Record using PHP Doctrine Project. In inserting a new record in a table with no parent table (no foreign key) no problem happens. But when inserting a related record here comes the problem, that I get only the parent id which is use...

using doctrine with codeigniter

Hi all, I am planning to use doctrine to write a module of my app which is built with codeigniter. I have a very basic question : lets say I have a table called "user", with doctrine generate-models from db, 3 classes are generated BaseUser.php, User.php and UserTable.php. Now as I saw in the examples they use User class straigtaway. ...

Symfony Doctrine Migration - Add new enum column

Hi there! Can anyone please tell me how can I add a new column of type enum to my schema in order to implement a Doctrine Migration? Thanks in advance, Best regards! ...

Doctrine Email Validation triggers on empty form field

Hi, I don't want an empty email field in my form to trigger a Doctrine_Validator_Exception. But, since Doctrine_Validator_Email uses "is_null()" to check for empty (non-existing) values (and the POST ['email'] contains an empty string), it does. Is this correct? Is there a simple way around this? This also has an impact when try...

Doctrine: How to save only collection items that do not exist in DB yet

I have a collection of items to save to database, but I want the record to be inserted only if not exists. I think the most effective way would be to filter the collection before saving. Can Doctrine do it automatically? Or shall I get all id's of all items in the collection, then query the database for items which do not exists on the...

Doctrine to Propel snippet

I am using the Propel ORM with SF (1.4). I am writing a class, and I need to rewrite a query Doctrine query into Propel: $q = Doctrine_Core::getTable('sfGuardRememberKey')->createQuery('r') ->innerJoin('r.sfGuardUser u') ->where('r.remember_key = ?', $cookie); if ($q->count()){ // Do Something } can anyone help wi...