Closed SamMousa closed 8 years ago
I'd split that repo into separate packages in the first place...
I still think that recipe is valid because it shows how to hack on AR.
I don't doubt the validity of the recipe ^^.
For now I prefer to maintain it as a single collection; if at some point more people start using it and bugs are getting reported / PRs made I'll refactor it to use a meta-package and separate packages.
Just wanted to mention it here so people using the cookbook could find the package.
So any things in the recipe itself which are wrong? If yes, would be great to fix these...
It requires changes in every subclass. So it's not wrong, but not (imo) the cleanest. Feel free to close this if you're happy with how it is though :)
I think it's OK. Properties could be extracted from it if there are many such classes which usually isn't the case.
Regarding: https://github.com/samdark/yii2-cookbook/blob/master/book/ar-single-table-inheritance.md
I have a package that simplifies STI and adds some more features that you don't get when using the method described codebook. It is located here: https://github.com/SAM-IT/yii2-magic
Some benefits:
ActiveRecord
and / orActiveQuery
implementations.