Click in "Generate Code". See? That easy.
The main code will be generated in app/Models/Base.
It will be one file for each object.
The main created files should not be changed, once they work just as a base for your real code.
Here is a sample of a Base-Object generated code:
<?php ## FILE GENERATED BY MAGRATHEA. ## SHOULD NOT BE CHANGED MANUALLY class ObjectBase extends MagratheaModel implements iMagratheaModel { public $id, $name, $value, $related_id; public $created_at, $updated_at; protected $autoload = null; public function __construct( $id=0 ){ $this->Start(); if( !empty($id) ){ $pk = $this->dbPk; $this->$pk = $id; $this->GetById($id); } } public function Start(){ $this->dbTable = "tab_arquivos"; $this->dbPk = "id"; $this->dbValues["id"] = "int"; $this->dbValues["name"] = "string"; $this->dbValues["value"] = "int"; $this->dbValues["related_id"] = "int"; $this->relations["properties"]["Related"] = null; $this->relations["methods"]["Related"] = "GetRelated"; $this->relations["lazyload"]["Related"] = "true"; $this->dbAlias["created_at"] = "datetime"; $this->dbAlias["updated_at"] = "datetime"; } // >>> relations: public function GetRelated(){ $this->relations["properties"]["Related"] = new Related($this->related_id); return $this->relations["properties"]["Related"]; } } class ObjectControlBase extends MagratheaModelControl { protected static $modelName = "Object"; protected static $dbTable = "tab_object"; } ?>
<?php include(__DIR__."/Base/ObjectBase.php"); class Object extends ObjectBase { // your code goes here! } class ObjectControl extends ObjectControlBase { // and here! } ?>