doctrine

prevent doctrine from create foreign key constraints

Is it possible to prevent doctrine 1.2 from adding foreign key constraints for a relation? ...

Doctrine, updating layouts and existing data

Hey folks! Please imagine you have an live-application with used data in your doctrine-controlled database. Now you find out that it's necessary to rename some cols and add some others. What is the best approach to accomplish this without too much struggling with your data? Please let my know if it's not clear what I mean, maybe I am ...

Two symfony routes with same url?

Is it possible two have to symfony routes (sfDoctrineRoute) with same url ( /:sf_culture/:slug/), but different model? ...

How do I access the list of tags linked to a blog post ?

I'm doing a blog engine using symfony as a learning exercice. How do I get the list of tags from the id of a blog post ? Here's the database shema : I added the following in the model : public static function getTags($id) { return Doctrine_Core::getTable('Tag') ->createQuery('t') ->select('t.name, t.slug') ->leftJoin('t...

doctrine findby magic null value

Hey fellow programmers, I'm wondering if there is anyway to use doctrine's magic method to look for null values. For instance: Doctrine::getTable('myClass')->findByDeletedAt(null); Essentially, i want to return all records that are not deleted. I've tried the above, but it doesn't seem to work. Any ideas? ...

Taking advantage of Doctrine relations in frontend applications in Symfony

Let's consider the following simple schema (in Doctrine, but Propel users are welcome too): User: columns: name: string Article: columns: user_id: integer content: string relations: User: local: user_id foreign: id Now, if you create a route for Article model and generate a module via doctrine:generat...

Doctrine - Compare two objects

Hi! What would to know the best way to compare two objects using Doctrine! On the domain login I am considering, two objects are equal if they have the same properties values, except the id and the created_at and updated_at auto-generated fields through the Timestampable behavior. Thanks in advance for the help, Best regards! ...

Doctrine postSave, postUpdate and Internationalization (detect modification)

I'm having a little problem with a tables that are using the i18n behaviour on a Symfony 1.4 project that I'm developing. For example on the following model defined on YAML (I have others that follow the same pattern): Subject: actAs: Timestampable: ~ I18n: fields: [name] columns: name: { type: string(255), notnull...

Symfony -- How to write a functional test with user authentication?

I am writing a functional test for a page that requires user authentication. I am using the sfDoctrineGuard plugin. How do I authenticate a user in my test? Do I have to enter every test through the sign in screen? Here is my incorrect code: $b->post('/sfGuardAuth/signin', array('signin[password]' => 'password', '...

What does doctrine:generate-migrations-diff do a diff against?

Hello. :) This function purports to build doctrine migration classes based upon a diff between old and new schemas. Well, where is the old schema stored that the system is diff'ing against? I'm in a symfony project and there is only one schema.yml in my configs. The brunt of my problem, is that there was a problem with my schema that ...

how to initalize my ldap connection like a doctrine connection in the bootstrap.php file in zend-framework

i want to use my ldap server as a DB. then i will create persistence classes in the models directory that will extend to Zend_Ldap so that i won't have to write all the CRUD operations but how can i initialize the ldap connection in the bootstrap.php file for e.g. a database connection using doctrine can be initialized like this, i want ...

Doctrine 1.2 must have at least one field selected Error.but one is actually selected

Hello Good People! i've been banging my head against the wall over the past hour about this Exception : The root class of the query (alias b) must have at least one field selected on a small school hotel booking project here is the part of the schema concerned RoomType: actAs: [Timestampable] tableName: room_type columns:...

MySQL inclusion/exclusion of posts

This post is taking a substantial amount of time to type because I'm trying to be as clear as possible, so please bear with me if it is still unclear. Basically, what I have are a table of posts in the database which users can add privacy settings to. ID | owner_id | post | other_info | privacy_level (int value) From there, users c...

Problem with Codeigniter and Doctrine, migrating from Windows to Linux server

Hi, I’ve recently been learning how to use both Doctrine and CI and have been overhauling my website using both tools… all has been absolutely awesome up until the following issue(s) occurred: Essentially it would seem that either PHP, CI or Doctrine can’t find my Base classes unless I explicitly require/include them in the correspondi...

Save doctrine record without persisting

Hi, within my Unit-tests i would like to have the following behavior: $myNewDoctrineRecord = new Dto_MyRecord(); $myNewDoctrineRecord->pk = 1; //the primary key ... $myNewDoctrineRecord->save(); Now this record shouldnt really persist to the database. But i would like to do $myFetchedDoctrineRecord = Doctrine::getTable('Dto_MyRecord'...

Associations with Doctrine PHP

Hello, I'm trying to do an association of two objects with Doctrine (PHP). I have two objects : User and Conversation One user has many conversations and a conversation belongs to two users maximum (on initiator of the conversation, and one receiver). So, in my Doctrine class I have this in the Conversation class : $this->hasOne('Us...

How to create related records with Doctrine PHP

Hello I have modeled two classes with a many to many relationship : User and Conversation, and I can't create a the link between these two classes when I use them : class User extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('udid', 'string', 255); $this->hasColumn('nb_requetes', 'integ...

symfony - save method override and exceptions management

Hi! Currently, I am developing an application which domain model should prevent objects duplication according the equality or not of some object fields. So, I am thinking to handle this comparison on the save method of the class: if some existing object has some properties equal to the object to be saved, the save should be prevented. ...

Subqueries with Doctrine_RawSql

Is it possible to have subqueries in the select field of Doctrine_RawSql? $q->select('{t.*}, {i.*}, {e.*}, {f.*}, {f2.*}'); $q->addSelect("(SELECT f.id FROM Following f WHERE f.follower_id = ? AND f.following_id = t.owner_id) AS following"); $q->addSelect("(SELECT COUNT(c.id) FROM PostComments c WHERE c.post_id = t.id) AS num_comments")...

Symfony + Doctrine Many to Many relations with Linking Tables

Situation: I have 3 tables: Student, Address, StudentAddressLink As follows Note* not EXACT yaml file but you get the idea Student: column: id: blah blah name: blah blah Address: column: id: ~ street: ~ StudentAddressLink: column: id:~ student_id: ~ address_id: ~ relations: Student: ...