Managing entity persistence (model, resource, collection)
With InstallSchema
in place, we now have conditions for entity persistence. Our next step is to define model, resource, and collection classes for the Ticket
entity.
The Ticket
entity model class is defined under the app/code/Foggyline/Helpdesk/Model/Ticket.php
file with content as follows:
<?php namespace Foggyline\Helpdesk\Model; class Ticket extends \Magento\Framework\Model\AbstractModel { const STATUS_OPENED = 1; const STATUS_CLOSED = 2; const SEVERITY_LOW = 1; const SEVERITY_MEDIUM = 2; const SEVERITY_HIGH = 3; protected static $statusesOptions = [ self::STATUS_OPENED => 'Opened', self::STATUS_CLOSED => 'Closed', ]; protected static $severitiesOptions = [ self::SEVERITY_LOW => 'Low', self::SEVERITY_MEDIUM => 'Medium', self::SEVERITY_HIGH => 'High', ]; /** * Initialize resource...