Using entities - omneo/omneo-php GitHub Wiki
Entities are simple classes which contain attributes for a particular resource.
Introduction to entities
Most methods will return either a single or a collection of entities. An entity in it's basic form is simply a Data Transfer Object containing attributes. It may contain various helper methods for mutating attribute data like timestamps.
Entities extend Illuminate\Support\Fluent. If you are familiar with using DTO's in Laravel, you will be familiar with the interfaces here.
Working with entities
Attributes of an entity are accessible via public properties.
$omneo->profiles()->read(1)->email;
Often you will find specialised helper methods for accessing certain resource specific information. For example, profiles have an identities()
method which returns a collection of attached identities.
$omneo->profiles->read(1)->identities();
Entities can have their attributes cast to an array if you prefer that sort of thing.
$omneo->profiles->read(1)->toArray();
Building entities
For edit and add actions, you will need to build an entity to then pass into the action method. This can be achieved by simply passing an array to the constructor.
$omneo->profiles()->add(
new Omneo\Profile([
'email' => '[email protected]',
'full_name' => 'Mickey Mouse'
])
);