forked from codeigniter4/CodeIgniter4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path028.php
More file actions
41 lines (34 loc) · 677 Bytes
/
028.php
File metadata and controls
41 lines (34 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace App\Entities;
use CodeIgniter\Entity\Entity;
class User extends Entity
{
protected $datamap = [
'_role' => '_role',
];
protected $attributes = [
'__secure' => 'On',
'_role' => 'user',
'about' => '',
];
}
$user = new User(['__secure' => 'Off', 'about' => 'Hi, I am John!', '_role' => 'admin']);
echo 'Secure: ' . $user->__secure;
print_r($user->toArray());
print_r($user->toRawArray());
/**
* Output:
*
* Secure: Off
* Array
* (
* [about] => Hi, I am John!
* [_role] => admin
* )
* Array
* (
* [__secure] => Off
* [_role] => admin
* [about] => Hi, I am John!
* )
*/