Your IP : 216.73.217.13


Current Path : /home/rtorresani/www/vendor/magento/framework/EntityManager/Observer/
Upload File :
Current File : //home/rtorresani/www/vendor/magento/framework/EntityManager/Observer/BeforeEntityDelete.php

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Magento\Framework\EntityManager\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Event\Observer;
use Magento\Framework\Model\AbstractModel;

/**
 * Class BeforeEntityDelete
 */
class BeforeEntityDelete implements ObserverInterface
{
    /**
     * Apply model save operation
     *
     * @param Observer $observer
     * @throws \Magento\Framework\Validator\Exception
     * @return void
     */
    public function execute(Observer $observer)
    {
        $entity = $observer->getEvent()->getEntity();
        if ($entity instanceof AbstractModel) {
            $entity->beforeDelete();
            $entity->getResource()->beforeDelete($entity);
        }
    }
}