Multiple findby in symfony doctrine

JERC picture JERC · Jun 12, 2012 · Viewed 14.4k times · Source

I need to know if there is a way to do something like this:

$customerClient = $clientTable->findByCustomerNumber($this->array_data[$rowIndex]['D']);
$customerClient = $customerClient->findOneByEmpCartera($portfolio);

I get this error message

Call to undefined method Doctrine_Collection::findOneByEmpCartera()

I need do 2 filter in $clientTable object table,

Any advice will be usefull to me.

Answer

Radamanf picture Radamanf · Oct 31, 2012

Symfony 1.4 Actually can handle multiply fields in one go, but this is ridiculous how you should use this functionality

Doctrine::getTable('MtCheck')->findOneBy('idAndc_type', array($id,$type))

where table

CREATE TABLE `mt_check` (
  `id` int(11) NOT NULL,
  `c_type` int(11) NOT NULL,
  `c_ver` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`,`c_type`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

You can use 'And' or 'Or' exact, and no spaces before and after.