doctrine

How can I refer to different environment's inside Symfony's ProjectConfiguration.class.php

I have a staging and development environment on the same machine. I would like to configure a different memcached port in ProjectConfiguration.class.php depending on my environment. I imagine its not safe to use $SERVER['HTTP_HOST'] inside of the ProjectConfiguration file because that won't account for tasks run from the command line. W...

In Doctrine ORM, how can I sum seconds to a timestamp field?

I have a starts_at field that keeps a timestamp with the moment something starts. Also, I have another field seconds_long that represents the amount of seconds that the event lasts. I need to select all unfinished events but I just can't find a way to sum the starts_at and seconds_long fields. I first tried to sum them, expecting Doctri...

Symfony + doctrine + one-to-many relationships

Hi everybody. I need a one-to-many relationships for my sf 1.4 + doctrine 1.2 project. I copied the relation just like this: User: columns: id: type: integer(4) primary: true autoincrement: true contact_id: type: integer(4) username: type: string(255) password: type: string(255) Ph...

Issues with doctrine build in Symfony

I am getting stuck with this Symfony command after following the Jobeet tutorial on their site. After running the build model command, here's what I get: $ php symfony doctrine:build --model doctrine generating model classes file+ /private/var/folders/yX/yXtbVXwPHcCUpfC-n06OAU+++TI/-Tmp-/doctrine_schema_56533.yml ...

How to deal with m2m relationship(posts and tags) by doctrine(in symfony)?

posts and tags have a many-to-many relationship(pretty much like stackoverflow),so the code to do it without an ORM should be: $dml = "insert into posts(title,body,created) value($title,'{$_POST['post-text']}',now())"; mysql_query($dml,$con); $pid = mysql_insert_id($con); //deal with tags if(isset($_POST['tagnames'])) { $tags = preg_s...

Nestedset in Admin Generator

Hello, in a table "list" i save the id of another table, list also act as a nestedset. In a form i can add a child to a root. I set the value of the root as hidden field in the form. So in doSave when he detected a value in the hidden field, he do this, $parent = Doctrine::getTable('list')->findOneById($this->getValue('parent_id')); $...

How to relate two tables without a foreign key?

Can someone give a demo? I'm using MySQL,but the idea should be the same! EDIT In fact I'm asking what's the difference between Doctrine_Relation and Doctrine_Relation_ForeignKey in doctrine? ...

How to check if two records have a self-referencing relation?

Consider the following schema with users and their collegues (friends): Users User: columns: user_id: name: user_id as userId type: integer(8) unsigned: 1 primary: true autoincrement: true first_name: name: first_name as firstName type: string(45) notnull: true last_name: ...

Doctrine: How to do a UPDATE with a SELECT MIN subquery?

Hi, I have a photos table where users can have multiple photos. I'm trying to create the following query: $q = Doctrine_Query::create() ->update('Photo p') ->set('p.photo_type', 1) ->where('p.user_id = ?', $id) ->andWhere('p.date_added = (SELECT MIN(p.date_added) FROM Photo p WHERE p.user_id = ?)', $id) The idea is to se...

sfDoctrineGuardPlugin: login with email

Hi, I'm building a webapp with symgony1.4 and doctrine1.2, and I wanna use the sfDoctrineGuardPlugin, but I have a little problem. sfDoctrineGuardPlugin is built to authenticate by username, but I need to change it to ask for an email. Any idea how to do it? ...

String length at the start of a MySQL text field when using HYDRATE_NONE?

Hi, I'm using Symfony 1.4 with Doctrine. I'm saving text as MySQL text type (Doctrine "array" type) into the database, and it goes in clean & correct. When querying the data back, if I use Doctrine_Core::HYDRATE_ARRAY the data is returned as it should be. However, if I use HYDRATE_NONE, the data is returned with the text length append...

Why does Doctrine create an index on only one column in the linking table?

Just like stackoverflow, there is a many-to-many relationship between Question and Tag. After running these symfony commands: ./symfony doctrine:drop-db ./symfony doctrine:build-db ./symfony doctrine:build-model ./symfony doctrine:build-sql ./symfony doctrine:insert-sql With the following schema: schema.yml Tag: columns: name: ...

Doctrine 2.0 integration into Zend Framework 1.10

Hi, can anybody help me how to nice integrate doctrine 2.0 into ZF 1.10? I found some application resources, but there was no complete solution. Many thanks ...

Question about fetching only the rows of a table which has a concrete value in a concrete field using Doctrine 1.0

Hi, is there anyway to fetch only the rows of a table which has a concrete value in a concrete field. For example: $24_people = $table->getFieldAndValue('age', 24); I now i can do it with a query, but wouldn't you find useful this kind of functions? or maybe is no possible or is not convenient because some reason ? Regards Javi ...

What is array portability?

From this page: http://www.doctrine-project.org/documentation/manual/1_2/en/working-with-models#dealing-with-relations:creating-related-records You can see that it says $obj['property']; is the recommended way of referring to an object's property in Doctrine for array portability purposes. I never heard about this term before and goog...

PHP Doctrine ORM NestedSet

Hello, although I read through the manual here: http://www.doctrine-project.org/documentation/manual/1_2/hu/hierarchical-data I couldn't find a way to move a node from a Leaf to become a Root node. Any clues? The question is trivial for inserting a new node...but what about updating a node? ...

How to use PHPunit's Database Test Case Methods of Query to compare with doctrine query

How to use PHPunit's Database Test Case Methods of Query to compare with doctrine query i m using phpunit with doctrine framework .. i want to test my doctrine query with phpunit query with using phpunit framework methods.. any buddy with Doctrine Query and PhpUnit Query plz Contact... //Bhavin Rana. ...

Forum board example schema in YAML format - modify for Nested set?

I have created a forum board app, based on YAML schema found in 'real world examples' of Doctrine Manual, which looks similar to this: --- Forum_Category: columns: root_category_id: integer(10) parent_category_id: integer(10) name: string(50) description: string(99999) relations: Subcategory: class: Forum_C...

How to profile Doctrine in Zend Framework

Good day. I'm using Doctrine as ORM for my Zend Framework project. This is the first time I use it. I've followed the ZendCasts Doctrine chapters, and everything works for me, but I needed to perform some profiling; There is a Doctrine_Connection_Profiler class that should be used to profile the Doctrine Model internal queries, but I'v...

Symfony Migration - Remove mandatory from column

Hi there! I would like to cancel the mandatory of a field of my current schema. How can I accomplish that with a symfony migration? Thanks in advance, Best regards! ...