Added API resource mapping

This commit is contained in:
Alex Tselegidis 2021-11-03 08:21:03 +01:00
parent 226111e170
commit 6eaa6e52a5

View file

@ -27,6 +27,26 @@ class Admins_model extends EA_Model {
'id_roles' => 'integer', 'id_roles' => 'integer',
]; ];
/**
* @var array
*/
protected $api_resource = [
'id' => 'id',
'firstName' => 'first_name',
'lastName' => 'last_name',
'email' => 'email',
'mobile' => 'mobile_number',
'phone' => 'phone_number',
'address' => 'address',
'city' => 'city',
'state' => 'state',
'zip' => 'zip_code',
'notes' => 'notes',
'timezone' => 'timezone',
'language' => 'language',
'roleId' => 'id_roles',
];
/** /**
* Save (insert or update) an admin. * Save (insert or update) an admin.
* *
@ -560,7 +580,7 @@ class Admins_model extends EA_Model {
* @param array &$admin API resource. * @param array &$admin API resource.
* @param array|null $base Base admin data to be overwritten with the provided values (useful for updates). * @param array|null $base Base admin data to be overwritten with the provided values (useful for updates).
*/ */
public function decode(array &$admin, array $base = NULL) public function api_decode(array &$admin, array $base = NULL)
{ {
$decoded_response = $base ?? []; $decoded_response = $base ?? [];