My programming background is in different languages so I am tackling php and magento and learning as I go. so this may be a php question more than magento , but it would be good to know how people write scripts like this.
require_once '../../../app/Mage.php';
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app('admin');
$newStoreId = Mage_Core_Model_App::ADMIN_STORE_ID;
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(newStoreId));
class myClass
{
public function doStuff(){
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
var_dump($this->installer);
//etc..
}
$obj = new myClass();
$obj-> doStuff();
$this->installer is always null. I have tried all sorts of different variations. I don't want $installer to have any initial value , but I have tried declaring as a public variable.
How can I set this value ( $installer ) inside the class and have access to it inside the class?
I feel like I am fundamentally missing something.
Thanks for your time.