[英]Magento can't debug install script
我試圖毫不費力地調試我的安裝腳本。 當我嘗試在我的foreach循環中獲取任何輸出時,我的Mage :: Log()文件中沒有任何結果。
<?php
$installer = $this;
$installer->startSetup();
$attrCodes = ['attr1', 'attr2', 'attr3'];
$objCatalogEavSetup = Mage::getResourceModel('catalog/eav_mysql4_setup', 'core_setup');
Mage::log('hello before foreach');
// get all attributes
foreach ($attrCodes as $attrCode) {
Mage::log('Attribute code: ' . $attrCode);
}
Mage::log('hello after foreach');
$installer->endSetup();
我可以在foreach循環之前看到日志信息。 但在循環內或循環后我沒有任何信息。
不可能調試安裝腳本嗎? 我通常使用PHPStorm並使用內部調試器。 但是似乎我無法使用PHPStorm或Mage :: Log()調試安裝腳本。
編輯:
對此我感到非常抱歉。
我沒有在循環上方的注釋行中添加功勞,因此我決定在此處縮短代碼。
但事實是我無法在行注釋中調用升級腳本。
那就是我的問題的原因。 我必須將行注釋更改為塊注釋/ ** /,現在可以使用。
從來沒有碰到過magento這個問題。
同意“ Tipo”,問題出在foreach循環中。 創建數組時,應嘗試進行以下編輯:
$attrCodes = array('attr1', 'attr2', 'attr3');
嘗試此代碼並檢查:
$attrCodes = array('attr1', 'attr2', 'attr3');
Mage::log('hello before foreach');
foreach ($attrCodes as $attrCode) {
Mage::log('Attribute code: ' . $attrCode);
}
Mage::log('hello after foreach');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.