| @@ -1,18 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * @copyright © TMS-Plugins. All rights reserved. | |
| 4 | + * @copyright © Melograno Venture Studio. All rights reserved. | |
| 5 | 5 | * @licence See LICENCE.md for license details. |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace IvyForms\Factory\Entry; |
| 9 | 9 | |
| 10 | -// phpcs:disable PSR1.Files.SideEffects | |
| 11 | -if (!defined('ABSPATH')) { | |
| 12 | - exit; // Exit if accessed directly | |
| 13 | -} | |
| 14 | - | |
| 15 | 10 | use IvyForms\Common\Exceptions\ValidationException; |
| 16 | 11 | use IvyForms\Entity\Entry\Entry as EntryEntity; |
| 17 | 12 | use IvyForms\Entity\EntryField\EntryField; |
| 18 | 13 | use IvyForms\Factory\EntryField\EntryFieldFactory; |
| @@ -40,9 +35,9 @@ | ||
| 40 | 35 | $entryObject = new Entry( |
| 41 | 36 | $data['id'] ?? 0, |
| 42 | 37 | $data['formId'] ?? 0, |
| 43 | 38 | $data['userId'] ?? null, |
| 44 | - $data['status'] ?? 'unread', | |
| 39 | + $data['status'] ?? EntryEntity::DEFAULT_STATUS, | |
| 45 | 40 | $data['ipAddress'] ?? null, |
| 46 | 41 | $data['userAgent'] ?? null, |
| 47 | 42 | $data['sourceURL'] ?? null, |
| 48 | 43 | ); |
| @@ -57,8 +52,14 @@ | ||
| 57 | 52 | $entry->setFormId($data['formId']); |
| 58 | 53 | } |
| 59 | 54 | if (isset($data['userId'])) { |
| 60 | 55 | $entry->setUserId($data['userId']); |
| 56 | + } | |
| 57 | + if (isset($data['dateCreated'])) { | |
| 58 | + $entry->setDateCreated((string) $data['dateCreated']); | |
| 59 | + } | |
| 60 | + if (isset($data['dateEdited'])) { | |
| 61 | + $entry->setDateEdited((string) $data['dateEdited']); | |
| 61 | 62 | } |
| 62 | 63 | if (isset($data['status'])) { |
| 63 | 64 | $entry->setStatus($data['status']); |
| 64 | 65 | } |