doctrine

Doctrine: sort field in relations table (one to many), how to insert the sort number?

I have two tables, content and images (and a ContentImages table for the one to many relation, so that's actually 3 tables). The following code saves the relation (in the action > updateContentFromRequest() ): $ids = $this->getRequestParameter('contentImages'); if( isset($ids) ){ $ImagesTable = Doctrine::getTable('Content')->getR...

Doctrine-based CodeIgniter authentication/acl system

I'm working on web app based on CodeIgniter/Doctrine. I've tested several auth libraries, but all of them use ActiveRecord. Is there a plugin/library that uses Doctrine, or can be adapted to Doctrine?! Or can I use both Doctrine and CodeIgniter in a project?! ...

Symfony: how would you reverse the "notnull:true" in a schema of a plugin?

Hi, sfGuardUser model of sfDoctrineGuardPlugin is defined this way: sfGuardUser: actAs: [Timestampable] columns: id: type: integer(4) primary: true autoincrement: true username: type: string(128) notnull: true unique: true As you can see 'username' has the feature "notnull:true". Now i ...

Nested Set - for CMS with two versions (edit / publish) mode

Hi! I'm looking for a solution (PHP/Symfony/Doctrine) for the following problem. I'm creating a table called 'pages'. This table is a nested set. I also want to create a table called 'pages_published' which has ofcourse also a nested set. Once i create a record in table 'pages' at some point i want to publish this to the 'pages_publis...

How can I change the `invalid` message of doctrine?

Hi. I'm using symfony with doctrine and I make a registration form. Email field is declared unique and if I set it to already existing one, I get the message An object with the same "email" already exist.. I use the following validator: $this->validatorSchema['email'] = new sfValidatorEmail(array('required' => true), array('invalid' => ...

What's the best way to paginate a dataset with Zend_Framework and Doctrine?

Before I start to build this myself I thought I'd ask others to share their experience. What's the best / your favorite way to paginate a dataset with an application built upon Zend_Framework and Doctrine as your ORM? I'm new to Doctrine. I'm calling the model directly from a View Helper, bypassing the Controller, although I'm still in...

Polymorphic Associations in Doctrine?

Is there an equivalent to Rails-like polymorphic associations in Doctrine? I'm trying to do something similar to: http://railscasts.com/episodes/154-polymorphic-association ...

Why doesn't MySQL support millisecond / microsecond precision?

So I just found the most frustrating bug ever in MySQL. Apparently the TIMESTAMP field, and supporting functions do not support any greater precision than seconds!? So I am using PHP and Doctrine, and I really need those microseconds (I am using the actAs: [Timestampable] property). I found a that I can use a BIGINT field to store t...

PHP Doctrine: Custom nested set?

Is it possible to have nested set capabilities in this somewhat custom setup? Consider these 4 tables: Object: (oid, name) contains: [1, 'Licence'] and [2, 'Exemption'] Licence: (lid, name) Exemption: (eid, name) Cost: (oid, oid_ref, cost_oid, cost_oid_ref) For: P = Licence with lid [1] R...

Zend_Auth and database session SaveHandler

I have created Zend_Auth adapter implementing Zend_Auth_Adapter_Interface (similar to Pádraic's adapter) and created simple ACL plugin. Everything works fine with default session handler. So far, so good. As a next step I have created custom Session SaveHandler to persist session data in the database. My implementation is very similar t...

Logging from symfony's model layer

I'm currently working on a project with symfony 1.4 and Doctrine 1.2. I'm looking for a proper way to do logging from the model layer. In some model classes I use the record hook postSave() to create a ZIP file using exec() (since PHP zip doesn't provide for storage method 'Stored'). To be sure that everythings works fine I check the re...

PHP Doctrine: cannot find ClassName, but factory loading works..?

I'm using PHP Doctrine and i've setup autoloading: spl_autoload_register(array('Doctrine', 'autoload')); spl_autoload_register(array('Doctrine', 'modelsAutoload')); I can create a table like so: $table = Doctrine_Core::getTable('TableName'); However if I try it like this, it doesn't work, what am I missing?: $table = new TableName...

PHP Doctrine: generation problem?

I'm generating models from my Mysql db. It generates a foreign key collection properly, but not the other way around... Is this supposed to be 'by-design', or am i doing something wrong? pseudo code alert User: UserId pk LocationId fk //User location Location LocationId pk UserId fk //Location owner Generated cod...

PHP Doctrine: Filter Table?

I'm still not convinced after my previous question and some experience. Requirements: I don't want to use an SQL query everytime a filterBy() function is called and still be able to call ->filterBy() on the returned table. Please find the comment @ ObjectsTable class: "How to instantiate another table and add records which match t...

Overriding Doctrine_Record (sfDoctrineRecord) instance methods in Doctrine PHP Symfony

My background is in Propel, so I was hoping it would be a simple thing to override a magical getter in a Doctrine_Record (sfDoctrineRecord), but I'm getting either a Segfault or the override method is simply ignored in favor of the one in the superclass. https://gist.github.com/697008eaf4d7b606286a class FaqCategory extends BaseFaqCate...

How to delete refClass record in Doctrine?

Hi all! I have many-to-many relations with the following tables. post tag post_tag I created three classes with Doctrine, so I have the following classes as well. BasePost BaseTag BasePostTag in the setUp() method, I defined relations. I like to delete tag record when I delete post record. So I simply put cascade as descirbed on Doc...

Doctrine unsigned validation error storing created_at

Hi, I'm having problems with the Timestampable functionality in Doctrine 1.2.2. The error I get on trying to save() my Record is: Uncaught exception 'Doctrine_Validator_Exception' with message 'Validation failed in class XXX 1 field had validation error: * 1 validator failed on created_at (unsigned) ' in ... I've created the relev...

TO_DATE in DQL (DOCTRINE)

What's the problem with this DQL ? When I remove the TO_DATE in GROUP BY "it's work", between I need it there! SELECT COUNT(t.codigo), TRUNC((t.dataCadastro - TO_DATE('2010-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS'))/1)*1 + TO_DATE('2010-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') FROM TarefaNegociacao t GROUP BY TRUNC((t.dataCadastro - TO...

Benefits of Doctrine array column vs custom serialization?

I have an application that I'm converting to Symfony/Doctrine. It currently stores a serialized array as a JSON object in the database. I see that Doctrine has an array column that does similar serialization. Is there any performance benefit to the array column verses having custom json_decode/encode getters and setters? What serializati...

How to delete many-to-many records in Doctrine?

Hi All, I am trying to delete records in many to many using Doctrine. I used code on http://www.doctrine-project.org/documentation/manual/1_2/ru/working-with-models#many-to-many-relations:deleting-a-link when I do the first method, it just deletes UserGroup record ONLY. How do I delete User, Group, and UserGroup records at once? The se...