| Current Path : /var/www/html/app/code/FlipsDigital/TextbookListStudent/Model/ |
| Current File : /var/www/html/app/code/FlipsDigital/TextbookListStudent/Model/TextbookListStudent.php |
<?php
/**
* TextbookListStudent.php
*
* @copyright Copyright © 2021 FlipsDigital. All rights reserved.
* @author calvin.so@flipsdigital.com
*/
namespace FlipsDigital\TextbookListStudent\Model;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\Model\AbstractModel;
class TextbookListStudent extends AbstractModel implements IdentityInterface
{
const ENTITY = 'flipsdigital_textbookliststudent';
/**
* CMS page cache tag
*/
const CACHE_TAG = 'flipsdigital_textbookliststudent_textbookliststudent';
/**
* @var string
*/
protected $_cacheTag = 'flipsdigital_textbookliststudent_textbookliststudent';
/**
* Prefix of model events names
*
* @var string
*/
protected $_eventPrefix = 'flipsdigital_textbookliststudent_textbookliststudent';
/**
* Initialize resource model
*
* @return void
*/
protected function _construct()
{
parent::_construct();
$this->_init('FlipsDigital\TextbookListStudent\Model\ResourceModel\TextbookListStudent');
}
/**
* Get identities
*
* @return array
*/
public function getIdentities()
{
return [self::CACHE_TAG . '_' . $this->getId()];
}
/**
* Save from collection data
*
* @param array $data
* @return $this|bool
*/
public function saveCollection(array $data)
{
if (isset($data[$this->getId()])) {
$this->addData($data[$this->getId()]);
$this->getResource()->save($this);
}
return $this;
}
}