| 1 | <?php |
||
| 15 | class Entry extends AbstractObject |
||
| 16 | { |
||
| 17 | /** Suppress log sub-object */ |
||
| 18 | const SUPPRESS_LOG = false; |
||
| 19 | |||
| 20 | /** Suppress user sub-object */ |
||
| 21 | const SUPPRESS_USER = false; |
||
| 22 | |||
| 23 | /** Canonical field name for references to entry objects in the database */ |
||
| 24 | const ID = 'entry_id'; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Construct an Entry object from a database record |
||
| 28 | * |
||
| 29 | * @param array $databaseRecord Associative array of fields |
||
| 30 | * @param Log|false $log (Optional) Log sub-object (or `Entry::SUPPRESS_LOG`) |
||
| 31 | * @param User|false $user (Optional) User sub-object (or `Entry::SUPPRESS_USER`) |
||
| 32 | * |
||
| 33 | * @throws \Battis\SharedLogs\Exceptions\ObjectException |
||
| 34 | */ |
||
| 35 | 6 | public function __construct($databaseRecord, $log = self::SUPPRESS_LOG, $user = self::SUPPRESS_USER) |
|
| 46 | } |
||
| 47 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: