Posted January 17th, 2012 by Albert
I'm currently using the trial version of VS.PHP for Visual Studio 2010, specifically for working with the Magento shopping cart/cms. I really like what I've seen so far, and am very close to purchasing VS.PHP.
One thing I am having difficulty with is intellisense within a foreach loop. Here's my example:
<?php
/**
* @var Mage_Review_Model_Mysql4_Review_Product_Collection
*/
$allReviews = $this->getReviews($pageSize, $currentPage);
foreach(
$allReviews as $review )
{
/** @var Mage_Catalog_Model_Product */
}
?>The problem is that within the foreach loop, when using the $review variable, VS.PHP is giving me intellisense options for the Mage_Review_Model_Mysql4_Review_Product_Collection object. It *should* be giving me intellisense for the Mage_Catalog_Model_Product object.
Is this a bug, or am I doing this incorrectly?
juanc says:
Looks like a bug to me.
If you have a sample project would be great if you create a bug report with the sample project and instructions on how to reproduce it.
http://www.jcxsoftware.com/mantis
Thanks!
Juan
Albert says:
I'll do that.
I was mostly trying to figure out if intellisense within a foreach was supported or not. From what you said, it appears that it is a supported feature, but may be bugging in this case. That makes sense to me, because my setup is fairly complex (the Zend/Magento framework).