Defining Entities via EntitySchema
With EntitySchema
helper you define the schema programmatically.
When creating new entity instances, you will need to use em.create()
method that will
create instance of internally created class.
Using this approach, metadata caching is automatically disabled as it is not needed.
#
Using custom entity classesYou can optionally use custom class for entity instances.
Then you can use the entity class as usual:
#
Using BaseEntityDo not forget that base entities needs to be discovered just like normal entities.
#
Configuration ReferenceThe parameter of EntitySchema
requires to provide either name
or class
parameters.
When using class
, extends
will be automatically inferred. You can optionally pass
these additional parameters:
Every property then needs to contain a type specification - one of type
/customType
/entity
.
Here are some examples of various property types:
As a value for
type
you can also use one ofString
/Number
/Boolean
/Date
.