doctrine

Problems with behaviors in Doctrine

Hello Stack Overflow! I have a problem in one of my projects, where I'm using Doctrine as an ORM. For some reason, when rebuilding the models and database structure, Doctrine ignores the behaviors and relations, I define in one of the table definitions. The YAML table definition looks like this: ... User: actAs: Timestampable...

Doctrine order by relation table with limit

I have two tables "series" and "programs" with programs being many to one one series. Series table id | name -------------- 1 | lorem 2 | ipsum 3 | foo 4 | bar Programs table id | name | series_id --------------------- 1 | program1 | 1 2 | program2 | 2 3 | program3 | 3 4 | program4 | 4 5 | program5 | 1 6 | progra...

Doctrine inheritance not inserting record into parent table

I've got the following database structure: Account: columns: email: string(255) name: type: string(255) UserRegistered: columns: email: type: string(255) email: true notnull: true unique: true username: type: string(255) ...

Symfony Fails opening my sfDoctrineDatabase.class.php

My problem is very simple, yet I feel lost while looking at it ... I am currently working on a Symfony project located on an SVN repository. It has worked well all day but suddenly it crashed... Now I cant launch any page of my site. They all return me the same error message Fatal error: sfAutoload::require() [function.require]: Faile...

Doctrine (in symfony project) can not connect through socket

Hi guys ! I am trying to put a symfony project on a client server for production. The website worked fine on our company's server, but now i have this error : 500 | Internal Server Error | Doctrine_Connection_Exception PDO Connection Error: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql...

zend framework and doctrine (getters and setters)

Hi, Is it possible to use doctrine on existing entity models like: class user{ protected $_id; protected $_name; public function set_id($_id){} public function get_id(){} public function set_name($_name){} public function get_name(){} } or to generate or use models with hard-coded getters and setters. I dont want to use $user->na...

how to convert Doctrine object into json

I am using Doctrine 1.2, how could I get the query object into json / array format? $user = Doctrine_Query::create() ->select('u.id, u.username, u.firstname, u.lastname') ->from('User u') ->orderby('u.id') ->execute(); ...

How to Pass Variable inside DQL CodeIgniter

i got a question in DQL how to pass session User id $vars['mood'] = Doctrine_Query::create() ->select(’m.mood_name, a.id, m.account_id’) ->from(’mood m, m.account a’) ->where(’m.account_id=”7″‘) i want to show data according to current logged user. m.account_id=Current_User::user()->id; this is not working ...

Can I use whereIn in a query with named parameters?

I'm working on a Symfony app that uses Doctrine as the ORM. I want to run a query with an WHERE foo IN (bar) clause, and I'm adding the IN bit like so: $query->andWhereIn('p.foo', $bar); where $bar is an array of id numbers. Browsing the docs and trying out a few combinations, I was unable to make Doctrine treat the parameter I'm pass...

SQL search using Haversine in Doctrine

Hi, I want to do a search by coordinates, i.e. I want to have a function that works like this: function getLocationsInCircle($lat, $long, $minDist, $maxDist){ //return all the places that are at least $minDist //kilometers away and no more than $maxDist kilometers away } I have a "location" table that stores all location Ids...

Can anybody explain me this error..

I am firing a update query. Its working for one page and not working on other one. Can anybody take a look. thanks <br /> <b>Fatal error</b>: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens' in C:\xa...

Doctrine issues when using JOIN and WHERE

Hello all, I have a simple doctrine code: $dql = Doctrine_Query::create() ->select('u.ident, u.username, u.email') ->from('Users u, u.Attributes ua'); if ($query) { $dql->where('u.username LIKE ?', "%$query%") ->orWhere('u.name LIKE ?', "%$query%") ->orWhere('u.email LIKE ?', "%$query%"); } $dql->offset($start...

Doctrine many to many on same class

Hi, I'm trying to create a social-network like feature in an app I'm building, and Want to associate a Friend with another Friend. Assume I have this: Friend: connection: doctrine tableName: friend columns: id: type: integer(8) primary: true autoincrement: true name: type: string(75) notnull:...

Schema created but tables not

Hello Everyone, I just got Doctrine 1.2.1 working in my environment (ubuntu) together with the Zend Framework. When I run my doctrine command ./doctrine build-all-reload it gives me the output: build-all-reload - Are you sure you wish to drop your databases? (y/n) y build-all-reload - SQLSTATE[HY000]: General error: 1008 Can't drop d...

Zend Framework, phpUnit and Doctrine cause problems

Hello everyone. First some basic info: Ubuntu latest version Zend Framewrok 1.9.6 Doctrine 1.2.1 Php unit latest version I have been following this and thistutorial to set up my zend envrionment with doctrine and phpUnit. My environment is not an emtpy project since I had done some developments before I configured doctrine and php...

Make doctrine load auto_increment value after save

I'm using Doctrine for database abstraction. Now I'd like to get the auto_increment primary key from the freshly-created (and save()'d) object - but $obj->toArray() shows me that the field is empty after calling save(). Is there a flag that I'm not aware of that does this? Or do I really have to query the object from the database? ...

PHP - Doctrine ORM not able to handle bit(1) types correctly?

UPDATE I have filed a bug in Doctrine about this http://www.doctrine-project.org/jira/browse/DC-400 I have the following Doctrine schema: --- TestTable: columns: bitty: bit(1) I have created the database and table for this. I then have the following PHP code: $obj1 = new TestTable(); $obj1['bitty'] = b'0'; $obj1->save();...

Doctrine Subquery in InnerJoin

i have functional query in MySql: select t.won,e.etot, s.username,s.country,r.points,r.rank FROM sf_guard_user s INNER JOIN marks r ON r.user_id = s.id inner join (select t.user_id,count(t.user_id)as won from topper t group by t.user_id) t on t.user_id=s.id inner join (select e.user_id,count(e.user_id)as etot from exams e group by e.u...

Can I do more than one form for the same model class in symfony?

Well, imagine that we have a register form of a class Customer and we only ask three fields (name,surname,email) and after, when this user logged first time we want to complete this information. First, we have in lib/form/doctrine a file called 'CustomerForm.class.php' wich is generated automatic on command line. In this file we 'setup'...

What is correctness in symfony to fill a form in two steps?

Hy, What is correctness in symfony to fill a form in two steps? Imagine that we have a entity called Enterprise and we want to create a form with only required fields and another form, that when the user login can fill the other non-required fields. How is the correctness form? Now i have a form to registration ('lib/form/doctrine/Ente...