I am trying to override Enlight_Controller_Action_Backend_Article_Save inside custom plugin like below .
public static function getSubscribedEvents()
{
return [
‘Enlight_Controller_Action_Backend_Article_Save’ => ‘onSave’
];
}
public function onSave()
{
$data = $this->Request()->getParams();
if ($this->Request()->has(‘id’)) {
/** @var Article $article */
$article = $this->getRepository()->find((int) $this->Request()->getParam(‘id’));
// Check whether the article has been modified in the meantime
$lastChanged = new \DateTime($data[‘changed’]);
if ($article->getChanged()->getTimestamp() != $lastChanged->getTimestamp()) {
$namespace = Shopware()->Snippets()->getNamespace(‘backend/article/controller/main’);
$this->View()->assign([
‘success’ => false,
‘overwriteAble’ => true,
‘data’ => $this->getArticle($article->getId()),
‘message’ => $namespace->get(‘article_has_been_changed’, ‘The article has been changed in the meantime. To prevent overwriting these changes, saving the article was aborted. Please close the article and re-open it.’),
]);
return;
}
} else {
$article = new Article();
}
$this->saveArticle($data, $article);
}
Now i am getting error Fatal error: Call to undefined method OrderSample\OrderSample::Request()
Thanks