Magento e コマース システムでは、システムが完全にブートストラップされる前に発生する 3 つのイベントがあります。
resource_get_tablename
core_collection_abstract_load_before
core_collection_abstract_load_after
これらのイベントは、 Magento がブートストラップ した後にも発生します。
これらのイベントを安全に使用できるように 、 Magento が完全にブートストラップされたことを検出する安全でエレガントな (そしてイベント Mage コア チームが祝福した可能性がある) 方法は何ですか?
ブートストラップ前の状態で特定の機能を使用しようとすると、リクエスト全体が 404になります。
class Packagename_Modulename_Model_Observer
{
public function observerMethod($observer)
{
$is_safe = true;
try
{
$store = Mage::app()->getSafeStore();
}
catch(Exception $e)
{
$is_safe = false;
}
if(!$is_safe)
{
return;
}
//if we're still here, we could initialize store object
//and should be well into router initialization
}
}
しかし、それは少し扱いにくいです。