M
M
McMike2017-03-15 10:24:15
Yii
McMike, 2017-03-15 10:24:15

How to properly use getters and setters in models?

There are two models, B inherits from A.
Model B has a private attribute Atr and methods to access it getAtr() setAtr()
But model A defines magic __get and __set from PHP. They intercept the call to Atr from model B.
How to deal with this situation? Those. how now to access Atr from model B?
How would it be correct to build a get-set in inherited models?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2017-03-15
@Arik

You have an error somewhere, all magic methods work out when they do not find a method or property, respectively

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question