Need Backend Or Not?

Hi, gueses!

I have one question.

I finished many projects and in ever I have two (some times three) controllers on one entity.

For example: entity Article.

I have controllers: ArticleController (frontent), ArticleController (backend), ArticleController (api).

They lying in different dirictories.

But sometimes I think to do only one controlle ArticleController and in it I write all methods (for frontend,backend, api.) You can see it in gii yii CRUD.

It is good idea?

When I need to use one controller and many thin methods or two-three controllers for frontnd, backend, api?

Thanks. :mellow:


ofcourse you can do this using the yii-boilerplate infrastructure.

using the common folder for controllers there.

what i would do is , creating a shared component ArticleComponent ( with all shared function )

and let the controller use it.

hope this helps :)