Models
Models are the PHP representation of your database's tables.
note
📣  All commands have to be run in the api
service (make api
).
#
Generateconsole
This command will regenerate the TDBM models (and DAOs - more on that in the next chapter).
Models come in two kinds of classes. For instance:
BaseUser
.User
that extendsBaseUser
.
TDBM generates the first class, and it contains the default getters and setters.
You cannot modify it, but instead, edit the second class as TDBM does not override it.
note
📣  There are other kinds of classes in the src/api/src/Domain/Model folder, but they are not related to TDBM.
#
Create an instanceLet's say you have a model Foo
with the following properties:
bar
, non-nullable.baz
, nullable.
note
📣  A constructor of a model requires non-nullable values.