doctrine

Doctrine mapping examples using PHPDriver

Hi, I am investigating Doctrine 2 for PHP and I am having trouble finding good resources for how to map using the PHPDriver. There is extensive documentation on using Annotations in comments for the Doctrine mappings, however, I would rather have my mapping definitions in PHP and NOT in comments (for obvious reasons). I could use some...

Doctrine - Generating table classes and base classes

I've just started working with Doctrine and I don't quite understand the purpose of table classes and base classes. What is the benefit of generating them explicitly? Is any change necessary in the application logic when these classes are pre-generated and when they are not? Could you clarify this topic a bit? Thanks. ...

setPeerCount doctrine equivalent

In propel setPeerCountMethod is used to change the count query in pagination. Does anybody know its equivalent in doctrine? ...

schema.yml using sfDoctrineGuardPlugin

Hello, I'm building a schema.yml and I'm trying to add foreign key constraints to the table sf_guard_user. But, when I do doctrine:insert-sql (edit: doctrine:build --all), the links between my tables and sf_guard_user are not there ! Am I missing something ? I'm using mysql (InnoDB) and Symfony 1.4 Here's a sample of my schema.yml : ...

How to join table with itself in doctrine 2

is there any way using DQL write a query that joins table with itself? ...

Simulate signin/login using Symfony/sfDoctrineGuardPlugin

In a situation, where the user is authenticated on another application (like oAuth or a custom security implementation), how can we simulate login? What we intend to achieve is: - use the user identifier key to check if the user exists - if the user exists, set-up the session for the user - basically, setup the attribute holder - assign...

How should I be managing my schema using Doctrine?

The decision I'm trying to make is where I want to do schema changes. I need a schema update to happen in the database, in the model definition, and I'd also like to generate a doctrine migration for that change too. I would really prefer to only have to define schema changes in one place, not three. Right now I'm thinking of writing al...

Doctrine 1.2: Overriding Doctrine_Record::__get() from a template

I have a model class (obviously, it extends Doctrine_Record) that "acts as" a custom template. I want to get values like this: "echo $record->virtual_field". Is there a way to override the getter method in my custom template to provide a custom response, then either pass on the request to the parent class or not? In other words, is th...

Altering a database in symfony (doctrine)

I'm a beginner with symfony (1.4 + Doctrine), but there is a point which scares me. It seems that whenever one wants to change a model, the only way is to change the schema for the database (config/doctrine/schema.yml) and then call symphony doctrine:build, which flushes all the current data in the database. This does not seem to me lik...

How can I do set NULL into the table in Doctrine

I have some table store_section(id,parent_id,label), I want to change some row, set parent_id=null. I trying to: $record = $table->getTable()->find( $id ); $record->parent_id = null; $record->save(); But this isn't work. How can I do set NULL into the table in Doctrine, in example above, parent_id becomes =0 (not =NULL)? Thnx for th...

symfony captcha error redirect

I'm building a simple form mailer in symfony using sfExtraForm plugin captcha. Everything works except sfValidator is not redirecting the user and showing an error when any field is invalid. The only thing I can think of is I did not generate the module. I built it from scratch. I have to do the redirect manually. Is this because this i...

Do I need to hack ZendFramework1.10.8/Doctrine1.2.2 to get model generated?

Hello Experts!! I've started reading on zend framework and it's use with Doctrine and have implemented a small project to grasp the understanding.I've come to a point where i needed my model generated as in having a generate script like the one suggested in Doctrine 1.2.2 pdf manual.After few unsuccessful attempts like Class 'sfYaml...

PHP Doctrine - toArray() sets value for 'id' key to null

$this->model = Doctrine::getTable('Model'); $model = $this->model->find(1); var_dump($model->id); // returns: string '1' (length=1) var_dump($model->toArray()); // returns: array // 'id' => null // ... Why does that happen? ...

easy way to populate a doctrine 2 model with form data?

Imagine a User model like this: class User { /** * ...some mapping info... */ private $username; /** * ...some mapping info... */ private $password; public function setUsername($username) { $this->username = $username; } public function setPassword($password) { $this->password = $password; } } ...

Doctrine SQL/table generation failing

Hello, I am trying to make Doctrine generate SQL from a set of models that I created earlier with a YAML schema. Using the code below which comes from the manual the output should be a set of queries. <?php // test.php require_once('bootstrap.php'); try { $models = Doctrine_Core::generateSqlFromModels('models/generated'); ec...

PEAR Channel why do I need one?

So I guess a PEAR channel is like a server that lets you distribute your own PEAR packages? I was under the impression PEAR was sort of dead, until I started looking at Symfony (is it dead? I haven't used it in the past so maybe someone with more experience in PHP can comment on its state and whether it makes sense to invest any time in ...

Using doctrines findBy/getBy magic methods with the pager object?

Is it possible to use doctrines magic methods (in this case findBy*) with sfDoctrinePager? I'm getting the following error: Call to undefined method Doctrine_Collection::offset() Here is the code: $this->pager->setQuery(Doctrine::getTable('notification')->findByUserId($this->getUser()->getGuardUser()->getId())); I know I can build...

Is Doctrine2 compatible with PHP 5.3 up?

It seems doctrine 2 is compatible only with PHP 5.3 and up, and is NOT compatible with php versions before 5.3. Can someone confirm if this is true? ...

How to choose an ORM

The framework I'm starting to learn supports 2 ORMs out of the box. I don't think it matters for the purposes of this question to say which 2 ORMs. My question is more general than this. How do you in general decide which ORM to go with? I haven't used an ORM before, but I'm guessing there's a list of must-haves that any decent ORM must ...

How to use the I8n behaviour in combination with sluggable behaviour in Doctrine

Hi, i've got a table with articles. The table has the fields id, title and text. I'm using the sluggable behaviour on the title-field resulting in a unique url $sluggable0 = new Doctrine_Template_Sluggable( array('name'=>'url', 'fields'=>array(0 => 'title'), 'unique'=>true, 'canU...