tags:

views:

13

answers:

2

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

A: 

You mean something like this:

$table->createQuery()->where('age = ?', 24);

or:

$table->findAllByAge(24);

?

takeshin
A: 

Yes.

$24_people = Doctrine::getTable('People')->findOneByAge(24);

See Doctrine magic methods.

http://www.symfony-project.org/doctrine/1_2/en/06-Working-With-Data

Tom
Also, as a polite note, you've got a 0% accept rate, which means it's just going to get harder for you to get anyone to reply to your questions.
Tom