致命错误:在非对象上调用成员函数check()

时间:2017-03-27 17:39:49

标签: php

我们的网站在周末休息并开始返回致命错误。非常感谢任何帮助。

这里有完整的错误:

  

致命错误:在第109行的app / code / local / Mirasvit / Email / Model / Service / EventGenerateService.php中的非对象上调用成员函数check()

这是EventGenerateService.php文件的内容。第109行是底部$events = $event->check($eventCode, $timestamp, $observer);

的几行
class Mirasvit_Email_Model_Service_EventGenerateService implements Mirasvit_Email_Model_Service_EventGenerateInterface
{
    /**
     * Default strategy - schedule the emails starting from email queue generation date
     */
    const SCHEDULE_STRATEGY_DEFAULT = 0;

    /**
     * Event strategy - schedule the emails starting from event creation date
     */
    const SCHEDULE_STRATEGY_EVENT   = 1;

    /**
     * @var Mirasvit_Email_Model_Event
     */
    private $eventModel;

    /**
     * @var Mirasvit_Email_Helper_Event
     */
    private $eventHelper;

    private $scheduleStrategy;

    private $triggerId = null;

    public function __construct()
    {
        $this->eventHelper = Mage::helper('email/event');
        $this->eventModel = Mage::getModel('email/event');
        $this->scheduleStrategy = self::SCHEDULE_STRATEGY_DEFAULT;
    }

    /**
     * Set email schedule strategy, default or event
     *
     * @param int|null
     *
     * @return $this
     */
    public function setScheduleStrategy($scheduleStrategy)
    {
        $this->scheduleStrategy = $scheduleStrategy;

        return $this;
    }

    /**
     * Set associated trigger ID
     *
     * @param int
     *
     * @return $this
     */
    public function setTriggerId($triggerId)
    {
        $this->triggerId = $triggerId;

        return $this;
    }

    /**
     * {@inheritdoc}
     */
    public function generate(array $events, $timestamp = false)
    {
        foreach ($events as $eventCode) {
            $this->registerEvent($eventCode, $timestamp);
        }
    }

    /**
     * {@inheritdoc}
     */
    public function registerEvent($eventCode, $timestamp = false, $observer = null)
    {
        $event = $this->eventHelper->getEventModel($eventCode);
        // triggerId exists only in manual generation
        if ($this->triggerId) {
            $triggers = array($this->triggerId);
            /* @var $manualSaveProcessor Mirasvit_Email_Model_Service_EventSaveProcessor_ManualSaveProcessor */
            $manualSaveProcessor = Mage::getModel(
                'email/service_eventSaveProcessor_manualSaveProcessor',
                $this->scheduleStrategy
            );
            $event->setEventSaveProcessor($manualSaveProcessor);
        } else {
            $triggers = $this->eventHelper->getAssociatedTriggers($eventCode);
        }

        $events = $event->check($eventCode, $timestamp, $observer);

        if ($events) {
            $this->eventModel->addTriggerEvents($events, $triggers);
        }
    }
}

1 个答案:

答案 0 :(得分:1)

此错误表示未创建应由行$event = $this->eventHelper->getEventModel($eventCode);创建的对象。 您应该检查eventHelper的getEventModel方法