diff --git a/app/library/App/Resources/ProjectResource.php b/app/library/App/Resources/ProjectResource.php index 6f081b8..2a1ac44 100644 --- a/app/library/App/Resources/ProjectResource.php +++ b/app/library/App/Resources/ProjectResource.php @@ -14,7 +14,8 @@ use App\Model\Project; use App\Transformers\ProjectTransformer; use App\Controllers\ProjectController; use App\Constants\AclRoles; -//use PhalconRest\Mvc\Controllers\CrudResourceController; +use PhalconRest\Mvc\Controllers\CrudResourceController; + class ProjectResource extends ApiResource { @@ -27,6 +28,7 @@ class ProjectResource extends ApiResource { ->expectsJsonData() ->transformer(ProjectTransformer::class) ->handler(ProjectController::class) + ->handler(CrudResourceController::class) ->itemKey('projects') ->collectionKey('projects') ->allow(AclRoles::AUTHORIZED) diff --git a/schema/migration.php b/schema/migration.php new file mode 100644 index 0000000..6b5eb3c --- /dev/null +++ b/schema/migration.php @@ -0,0 +1,97 @@ +morphTable( + "products", + [ + "columns" => [ + new Column( + "id", + [ + "type" => Column::TYPE_INTEGER, + "size" => 10, + "unsigned" => true, + "notNull" => true, + "autoIncrement" => true, + "first" => true, + ] + ), + new Column( + "product_types_id", + [ + "type" => Column::TYPE_INTEGER, + "size" => 10, + "unsigned" => true, + "notNull" => true, + "after" => "id", + ] + ), + new Column( + "name", + [ + "type" => Column::TYPE_VARCHAR, + "size" => 70, + "notNull" => true, + "after" => "product_types_id", + ] + ), + new Column( + "price", + [ + "type" => Column::TYPE_DECIMAL, + "size" => 16, + "scale" => 2, + "notNull" => true, + "after" => "name", + ] + ), + ], + "indexes" => [ + new Index( + "PRIMARY", + [ + "id", + ] + ), + new Index( + "product_types_id", + [ + "product_types_id", + ] + ), + ], + "references" => [ + new Reference( + "products_ibfk_1", + [ + "referencedSchema" => "invo", + "referencedTable" => "product_types", + "columns" => ["product_types_id"], + "referencedColumns" => ["id"], + ] + ), + ], + "options" => [ + "TABLE_TYPE" => "BASE TABLE", + "ENGINE" => "InnoDB", + "TABLE_COLLATION" => "utf8_general_ci", + ], + ] + ); + } +} \ No newline at end of file -- libgit2 0.21.4