doctrine

Having a relation 1 to many on Doctrine but having 2 fields being the primary key on the other end

Hi ! Does anyone knows how can I have a relation 1 to many in doctrine but in this special way: in my principal table I have some fields, almnost none of them are fields which could have translations Table1: table_id <- primary key numeric_field1 numeric_field1 numeric_field3 now in my Table1_translations I have all the fields which ...

How I can use i18n Doctrine Behavior??

I'm trying to make this behavior works, but i don't know where it's crashing. How do you use this behavior? ...

How to optimize image processing in Symfony from model

Hello, guys! Assume a Doctrine model Profile: # This is example of my schema.yml Profile: columns: avatar: type: string(255) notnull: true My goal is to generate profile's avatar from uploaded file: class Avatar extends BaseAvatar{ public function postSave($e){ if($this->getAvatar()){ // resize/crop it to 1...

Self join without relations in Doctrine ORM

I have a class MenuItem act as NestedSet with many roots: MenuItem: actAs: NestedSet: hasManyRoots: true rootColumnName: root_id I want to retrieve a path from root to selected node. SQL-query for this is: SELECT m2.* FROM menu_item m INNER JOIN menu_item m2 ON m2.lft <= m.lft AND m2.rgt >= m.rgt WHERE m...

What'd be a good pattern on Doctrine to have multiple languages

Hi! I have this challenge which consist in having a system that offers it's content in multiple languages, however a part of the data contained in the system is not translatable such as dates, ints and such. I mean if I have a content on the following YAML Corporativos: columns: nombre: type: string(254) notnull: tr...

php basic array question

I'm having trouble getting the value of the last insert Id from doctrine. I did a bit of research and I found that the following should work: //save the store now $store = new Store(); $store->url = $this->form_validation->set_value('website'); $store->save(); $store_id = $store->identifier(); echo print_r($store->identifier()); Ret...

php doctrine last identifier issue

I'm running in to the issue below when trying to run the following: $store = new Store(); $store->url =$this->form_validation->set_value('website'); $store->save(); $store_id = $store->identifier(); Fatal error: Uncaught exception 'Doctrine_Connection_Exception' with message 'Couldn't get last insert identifier.' in /home/yummm/public...

Automatically getting a query instead of a result set in Symfony

In my schema, a user is related to their questions. I want to display all questions asked by a user. I also want this page to be paginated using sfDoctrinePager which requires a Doctrine_Query as a parameter. I know I can call $my_user->getQuestions() to get all questions from my_user, but is there a way to get the query to get all th...

How can i get in between rows in mysql query.

I want to fetch intermediate rows from by database. Like for last 10 rows i will use limit : return Doctrine_Query::create() ->select('v.*') ->from('Video v') ->where("v.community_id='$community_id' AND v.user_id='$user_id' AND v.published='$published'") ...

Is this possible to join tables in doctrine ORM without using relations?

Suppose there are two tables. Table X-- Columns: id x_value Table Y-- Columns: id x_id y_value Now I dont want to define relationship in doctrine classes and i want to retrieve some records using these two tables using a query like this: Select x_value from x, y where y.id="variable_z" and x.id=y.x_id; ...

Symfony (doctrine): "Embedding" foreing forms

Hi folks, I always have this kind problem with Symfony : Let's say you have a product, and you want to add it some photos. I guess like this there's no problem : Product: columns: name: { type: string(255), notnull: true, unique: true } Photo: columns: product_id: { type: integer, notnull: true } name: { type:...

sfDoctrineGuard problem

I have a problem with my sfDoctrineGuardPlugin... this question is related to... http://stackoverflow.com/questions/2183552/two-tables-relation-with-sfdoctrineguard-user-table-symfony I create the entity Enterprise and Customer and associate well with their group and entity. Now i create a module called sfGuard whith signinSucces.php b...

How to get past day from current time in php

I want to calculate whats the date 20 yrs back from current time in php.How can do that.I am not able to figure this out in a proper manner. Scenario is: I am having a column dob in mysql. Now i want to retrieve all the users who age is more than 20yrs and less than 25 yrs. I am using doctrine orm Edit Its working fine but giving a w...

Doctrine compile error?

In order to improve performance I tried to compile doctrine as per the manual Doctrine improvemnts tips first run : Doctrine::compile('Doctrine.compiled.php', array('mysql')); and later (after file created) require_once (LIBS.'Doctrine.compiled.php'); $manager = Doctrine_Manager::getInstance(); $conString = $_CONFIG['user'].':'.$...

Doctrine relation betwen two tables

I have two tables A and B. A have one or more registers in B. I want to join two tables and extract all information about A. I do that: Schema.yml A: fields..... B: fields... relations: A: { onDelete: CASCADE, local: a.id, foreign: b.id, foreignalias: AB } And i try to do that... $q = Doctrine_Query::create() ->from...

Where exactly does doctrine need PEAR Installer and Pear Package?

I'm trying to install this ORM library, but I see it requires PEAR Installer and Pear Package,where are they used? ...

A newbie question about doctrine

Select * from tableName order by id desc limit 10 How to perform something like the above with doctrine by a demo? ...

How to do fulltext search with doctrine?

WHERE column = value ->add(column, value); WHERE column <> value ->add(column, value, Criteria::NOT_EQUAL); Other Comparison Operators > , < Criteria::GREATER_THAN, Criteria::LESS_THAN >=, <= Criteria::GREATER_EQUAL, Criteria::LESS_EQUAL IS NULL, IS NOT NULL Criteria::ISNULL, Criteria::ISNOTNULL LIKE, ILIKE Criteria::LIK...

Can not load related tables when executing query from Doctrine_Record

I'm struggling with a very strange problem, and I cannot seem to fix it. Short version When I execute a query from within a Doctrine_Record, it just doesn't seem to work when I try to get a related table. I get an Exception: error: Uncaught PHP Error: Trying to get property of non-object in file D:/Tools/Development/xampp1.7/htdo...

Symfony + Doctrine - possible to link more than 2 tables/models together?

I've created an sfGuardUserProfile model that has a relation to the sfGuardUser model. Then I define another model with a relation to sfGuardUserProfile. I don't get any errors when I create the database, but when I try saving data to sfGuardUserProfile in my actions file, I get this error: SQLSTATE[23000]: Integrity constraint viola...