Closed rande closed 11 years ago
Thanks you for your suggestion :-)
You're perfectly right: proper getters should be used. The __get
method has been used for convenience, but it should be replaced.
But I'm not so sure we need the PrismicDataModel abstract class:
__get
definitions are code duplication, but not logic duplication. It's a bit like constructors: it's normal to write them, because it's kind of a part of the language, not a part of the business logic.__get
. If we add a special class for providing it to every classes, we encourage everyone to use it.So I close this issue because we won't introduce this abstract class (at least for now), and I created the issue #6 for the __get
removal.
amen
Hello,
The prismicio API is built on top of the magic method
__get
. It will be better to have proper getter and not relying on this feature. I guess this has been done to respect other api.So in order to avoid duplicated code, it will be great to have a parent
PrismicDataModel
object to include this code. This will required to change property visibility fromprivate
toprotected