lithium\data\Model::$_schema
Defines the data schema in array notation or, after initialization, holds the schema object.
Model
subclasses can manually define a schema in array notation. The array
notation will then be lazily converted to a schema object by the first call to
Model::schema()
.
The schema should only be defined in subclasses for schemaless persistent data sources (e.g. MongoDB), for all other data sources this is done automatically. If you desire a fixed schema for a schemaless data source, the following example shows how you'd define one manually.
For MongoDB specifically, you can also automate schema definition. Please see lithium\data\soure\MondoDb::$_schema for more information.
protected $_schema = [
'_id' => ['type' => 'id'],
'name' => ['type' => 'string', 'default' => 'Moe', 'null' => false],
'sign' => ['type' => 'string', 'default' => 'bar', 'null' => false],
'age' => ['type' => 'integer', 'default' => 0, 'null' => false]
];
Source
protected $_schema = [];