| Total Complexity | 5 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class FormContentGlobDelete extends Model |
||
| 15 | { |
||
| 16 | /** @var Content[]|Collection */ |
||
| 17 | private $_records; |
||
| 18 | |||
| 19 | public $data = []; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * FormContentGlobDelete constructor. Pass records inside. |
||
| 23 | * @param Content[]|Collection $records |
||
| 24 | */ |
||
| 25 | public function __construct($records) |
||
| 26 | { |
||
| 27 | $this->_records = $records; |
||
| 28 | parent::__construct(); |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Construct records into data array to display in view |
||
| 33 | */ |
||
| 34 | public function before() |
||
| 35 | { |
||
| 36 | // set data to display in view |
||
| 37 | foreach ($this->_records as $row) { |
||
| 38 | $this->data[] = [ |
||
| 39 | 'id' => $row->id, |
||
| 40 | 'title' => $row->getLocaled('title'), |
||
| 41 | 'date' => Date::convertToDatetime($row->created_at, Date::FORMAT_TO_HOUR) |
||
| 42 | ]; |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Delete founded records |
||
| 48 | */ |
||
| 49 | public function make() |
||
| 53 | } |
||
| 54 | } |
||
| 55 | } |
||
| 56 |