Array conversion
Array
(
[id] => 1
[username] => Tester
[password] => c098c977b6c9242f738ed521a63cb7e8
[email] => test@example.com
[created] => 2024-12-07
)
Activerecord to array
<?php
// create customer object
$customer = new \customer();
// load the customer properties from customer 1
$customer->get_by_id(1);
// assign the customer to the view
$this->view->customer = $customer;
// convert to Array
print_r($customer->toArray());
Source array to activerecord
<?php
// create an array
$data = [];
// set the properties and values
$data['id'] = null;
$data['username'] = 'Testertjes\'dfgdf';
$data['password'] = 'c098c977b6c9242f738ed521a63cb7e8';
$data['email'] = 'barebone@it-api.nl'
$data['active'] = '1';
// create customer object
$customer = new \customer();
// set the array as values to the customer object
$customer->set_data($data);
// save the customer
$customer->save();