# Collections
Lodata implements Collections (opens new window) of primitive and complex types.
Collections are defined through the Type::collection()
definition. The underlying type is Edm.Untyped
by default,
allowing any primitive or complex entries. To set a more specific underlying type, the type definition can be supplied
as an argument to Type::collection()
.
$person = (new EntityType( 'person' ))
->addDeclaredProperty( 'name', Type::string() );
->addDeclaredProperty( 'emails', Type::collection() );
->addDeclaredProperty( 'scores', Type::collection(Type::decimal()) );
1
2
3
4
2
3
4
Collection instances implement the Arrayable
interface, so they can be easily built at runtime in singletons or
operations.