F
F
freeman02042017-01-08 23:39:37
Yii
freeman0204, 2017-01-08 23:39:37

Is it possible to start writing a class separately from yii2, and then insert it into yii2 and make it work right away?

Heard about entities in OOP, and every class is an entity. Here I want to make a class (entity) for registration, statistics on the site. It will be 2 classes. Can I make them separately (in another project in a separate file), and then paste them into yii2 and make them work right away?
I want it to be such as if they blew which you just copy into the project (these 2 files) and everything works the same there.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stanislav, 2017-01-09
@Stasgar

You can, but setting it to "2 clicks" will not work, most likely you will have to write a separate interaction interface for the framework. In any case, the idea is stupid and the game is not worth the candle.

D
davidnum95, 2017-01-09
@davidnum95

Each framework has its own way of working with the database, Yii has ActiveRecord. So no, you can't. You will have to rewrite the code for a specific framework.

M
Maxim Fedorov, 2017-01-10
@qonand

Here I want to make a class (entity) for registration, statistics on the site

I doubt that you will have 1 class, it is rather a set of classes that you will get (module)
Here you need to understand what you plan to do projects on. If you want to do all projects in Yii and use the developed functionality everywhere - then yes, you can easily do it. If you want to make a universal module that you plan to use on different frameworks, then it will be very difficult to make it universal.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question