doctrine

Temporary Connection to External Database with Symfony/Doctrine

Summary: I want to be able to run a query against an external database to grab some needed data at the time the user logs in. I don't want this site to do anything else with the external database. Long term, it may need to be able to push data back, but specifically, I don't want symfony to try to build the schema for the external db, i...

Codeigniter + Doctrine architecture

Hi, I am building a system based on Codeigniter + Doctrine. The system will have three access points. Backend side, Customer Side and Websevice Side. (Each side is a CI application folder) I am creating the CRUDS under the Backend/models I want to reuse it in the other CI applications folders. What is the best architecture for that?...

Where should the business logic be placed when using Doctrine 2 and Zend Framework

Hi all, I've a question related to Doctrine 2 and Zend Framework. If you use Zend Framework without Doctrine by default you place business logic in the models. But as Doctrine 2 does have Entities where should the business logic be placed? I first had created models where the entity manager did calls to the Entities. But when I wanted...

Optimised solution to store order of rows in a database

Hi, I have a data model in Doctrine/symfony. I have a 'Course' which has many 'Lesson's. For each lesson I need to calculate the order (by date) that the lesson appears. For example, the Course 'Java for beginners' might have 10 lessons during October, I need to retrieve the order of these lessons so that the first one is called 'Java f...

Doctrine CLI: Register new custom task

I am using Doctrine 1.2 & ZF 1.10. I have my Doctrine CLI setup fine to do the default tasks. But I have created a couple classes I would like to be able to execute from the command line. How would I setup my application.ini or doctrine.php to register and use these new classes? For instance, I want to be able to execute APPLICATION_PATH...

Updating models in a Doctrine Migration

I'm trying to update a model in the context of a Doctrine_Migration. Calling save() on the object doesn't seem to update the database. I also tried calling execute() a Doctrine_Query in the context of a Doctrine_Migration. I tried running getSqlQuery() on the query object and I get a valid query that works if executed in a mysql console,...

Doctrine one-to-many relationship returns a Doctrine_Record instead of Doctrine_Collection

I've run into a bit of a snag in my application where a relationship defined as a one-to-many relationship returns a model object (instance of Doctrine_Record) instead of a Doctrine_Collection when I try to access it as $model->RelatedComponent[] = $child1. This, of course, yields an exception like so: Doctrine_Exception: Add is not ...

How to do to use different connections in Doctrine ?

Hi all, I tried to use several transactions in Doctrine (v1.2.2). Here my test: // Open a new database connection $cnx1 = Doctrine_Manager::connection('mydsn'); // $cnx1 will be named '0' // Open a second database connection $cnx2 = Doctrine_Manager::connection('mydsn'); // $cnx2 will be named '1' // Start a transaction on connection...

Doctrine and its use

Can any one tell me 'What is doctrine not good for? please describe a scenario where we definitely wouldn't use Doctrine. ...

Star Schema with Doctrine ORM

Hi, I've just come across the Star Schema for Report-Aggregation. The first Question that came to my mind is whether or not Doctrine ORM supports such denormalized Tables. As I've seen ist, there are a feww kinky behaiviours in dealing with relations, a Model could not completely know. Any ideas? Is it possible? ...

Doctrine (symfony) YAML schema/fixture constraint trouble

Morning, I'm having some trouble creating tables/loading fixtures. (symfony 1.4.6 with the bundled Doctrine 1.2.3(?)) Tables (simplified): Horseman: tableName: Horseman actAs: { Timestampable: ~ } columns: id: { type: integer(4), primary: true, autoincrement: true, unsigned: true } name: { type: st...

No database connection via doctrine in symfony

Hi, I'm working on the symfony tutorial jobeet and I have problems to get a database connection to the MySQL-database via doctrine. Development enviroment: Mac OS X and XAMPP. The command 'php symfony doctrine:build-schema' gives me the following error message: Warning: PDO::__construct(): [2002] No such file or directory (trying to ...

What happens to symfony when the database is offline?

What exactly happens when the database attached to symfony goes offline or is unreachable? Maybe the answer to this question is in my face and I don't realize it, but I've been searching for the last while and still coming up empty handed. I've attempted to simulate this myself (in the "production" environment) by just stopping the data...

how to use non-database variables in doctrine model

I have two database fields '$object->value' and '$object->max_value' and want to store the proportion in $object->percent_value without having a db field for it. Is there a way to do this in a doctrine model? ...

Can't Load Models in CodeIgniter with Doctrine

Hi all, I have been trying out CodeIgniter. So far, I like it. I decided to also try out Doctrine because I hear so much about ORM and that Doctrine is great. I found some tutorials: phpandstuff blog medryx blog Doctrine Cookbook CodeIgniter wiki I have tried all of the methods that I found at those to try to set up a working D...

symfony doctrine data-dump and reload wont't work

Hi, I have a database built by Doctrine from schema.yml which I want to modify. Thus, first I saved the data using doctrine:data-dump command. Afterwards I wanted to check if it really can reload data, so I called the doctrine:build --all --and-load command. It successfully rebuilt the database, however when loading data from data1.yml...

how to find a specific related object with doctrine 1.2

Hi, this code example from doctrine 1.2 manual gives me one phonenumber and areacode for the user: $q = Doctrine_Query::create() ->from('User u') ->leftJoin('u.Phonenumbers p') ->where('u.id = ?', 1); $user = $q->fetchOne(); echo $user->Phonenumbers[0]['phonenumber']; echo $user->Phonenumbers[0]['areacode']; Is it possible to get t...

How to declare Doctrines Inheritance in a fixtures.yml file?

Hello folks, I have a problem with the inheritance of Doctrine within my fixtures.yml file of Symfony. Imagine the following: NewsAuthor: inheritance: extends: sfGuardUser type: simple Now I want to declare the default guard user User_admin of the fixtures file of the sfDoctrineGuardPlugin to be the author of the first d...

Doctrine query only returning one row?

I'm new to Doctrine but somewhat familiar with SQL. I have a very simple schema with Users and Challenges. Each Challenge has a "challenger id" and a "opponent id" which are foreign keys into the User table. I want to print a list of all challenges, with the output being the names from the User table. Here is my Doctrine query; $q =...

Doctrine ORM - Prefixing Tables

Hi, I'm using Doctrine 1.2, and would like to know how I can achieve mysql table prefixes with it. So for instance I would like for our system to be deployed twice on the same database, the first the tables can be prefixed with "one_" and the second can be prefixed with "two_". Anyone got any idea how to accomplish this? I would imagi...