Selecting certain fields using Propel select criteria?

This is how to do it: $criteria = new Criteria(); $criteria->clearSelectColumns(); $criteria->addSelectColumn(MerchantsPeer::NAME); $criteria->addSelectColumn(MerchantsPeer::ID); $criteria->addSelectColumn(MerchantsPeer::CATEGORY); $this->MerchantsStmt = MerchantsPeer::doSelectStmt($criteria) $this->MerchantsStmt is a PDOStatement object, which can be iterated using the fetch() method. See here for more details: PDOStatement In order to display the content in the template, you need to know that symfony 'protects' the content of the object passed to the template to prevent malicious code from being executed. If you trust the content of the $MerchantsStmt object, then you can iterate it like this:?

Php $MerchantsStmt = $sf_data->getRaw('MerchantsStmt'); foreach ($MerchantsStmt->fetchAll() as $value) { //some display logic }?

This is how to do it: $criteria = new Criteria(); $criteria->clearSelectColumns(); $criteria->addSelectColumn(MerchantsPeer::NAME); $criteria->addSelectColumn(MerchantsPeer::ID); $criteria->addSelectColumn(MerchantsPeer::CATEGORY); $this->MerchantsStmt = MerchantsPeer::doSelectStmt($criteria); $this->MerchantsStmt is a PDOStatement object, which can be iterated using the ->fetch() method. See here for more details: PDOStatement In order to display the content in the template, you need to know that symfony 'protects' the content of the object passed to the template to prevent malicious code from being executed. If you trust the content of the $MerchantsStmt object, then you can iterate it like this: getRaw('MerchantsStmt'); foreach ($MerchantsStmt->fetchAll() as $value) { //some display logic }?

Thank you. I went with your solution and grabbed the whole array using ->fetchAll(). Now I am using foreach to traverse through it.

How do I get specific values though? It seems like it is an object of type object(sfOutputEscaperArrayDecorator) – Aamir Oct 21 '10 at 19:05 Added a solution for iterating the content to the answer above. – Raise Oct 21 '10 at 19:15 Works superb.

Learned something new today. Thank you! :-) – Aamir Oct 21 '10 at 19:33.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions