I have created a new Magento module and create a new theme in Magento but the auto-load error has come
Magento 2 – How to Solve Auto Load Error
magento2varien-autoload
Related Solutions
You can't do this without a core hack. My recommendation is use composer autoloader along with default autoloader in Magento. You can implement this either by :
Require composer autoloader via
Mage.php
Listen to very first events which is generating by Magento and require composer autoloader via your observer. (more cleaner approach).
Put
Varien_Autoload
inlocal
codepool and put your autoloader logic in that file. (Recommendation from Vinai Kopp)
You have a wonderful answer from Alex from this thread.
EDIT
Solution - 1
If you just want to autoload classes inside a particular namespace (if they are follows PSR-0 standards), then Magento-PSR-0-Autoloader will be the best option. All you need to do is, install this extension and edit your app/etc/local.xml
file and put this
<psr0_namespaces>
<DTS\eBaySDK\Constants />
</psr0_namespaces>
Note : However I have no past experience with this extension. I may be wrong. But play around it. I think it would be sufficient for you.
Solution - 2
However if you really need to go on with your autoloader in your question, Then create a module and observe to the event resource_get_tablename
.
File : app\code\{codePool}\{Namepace}\{Module}\etc\config.xml
<config>
<global>
<events>
<resource_get_tablename>
<observers>
<namespace_module>
<class>namespace_module/observer</class>
<method>addAutoloader</method>
</namespace_module>
</observers>
</resource_get_tablename>
</events>
</global>
</config>
File : app\code\{codePool}\{Namepace}\{Module}\Model\Observer.php
<?php
class Namespace_Module_Model_Observer
{
const AUTOLOADER_FILE = 'path/to/your/autoloader.php';
public function addAutoloader()
{
require_once self::AUTOLOADER_FILE;
return $this;
}
}
Here we are observing to resource_get_tablename
event because which is the very first event that is fired by Magento. In our observer we are simply requiring the autoloader file in the question. So dont forget to put the correct file path for the constant AUTOLOADER_FILE
.
That will register your custom autoloader and hence Magento uses your autoloader prior to the default autoloader.
Your action for the 'customer_id' field is ACTION_SET_NULL but that field was defined as not nullable in your script: 'nullable' => false
Try changing 'nullable' => false to 'nullable' => true
Best Answer
1. Cache issue
2. Permission Issue