Closed armpogart closed 9 years ago
@armpogart Did you override $languageField
property in your query class? It should be language_id
@OmgDef No, I haven't overridden $languageField
, it is on it's default language
, so it is commented out. And without overriding attributes()
function Yii2 gives error that there is no such title attribute
and same for content
.
languageField
field in database is also language
, not language_id
as in my example.
@armpogart What version of the extension do you use?
We are using composer require:
"omgdef/yii2-multilingual-behavior": "*"
with "minimum-stability": "stable"
It seems that latest release version was 1.0.3
and that was the reason I was getting that strange behaviour.
It would be also great to mention behaviour version in files too, or at least at README, because having behaviour in vendor folder, it was impossible to tell what version I was using.
@armpogart You should modify require section in your composer.json to: "omgdef/yii2-multilingual-behavior": "~2.0" or "omgdef/yii2-multilingual-behavior": "~1.0" ,if you what to use the first version Docs for first version here https://github.com/OmgDef/yii2-multilingual-behavior/blob/f91d63403f02c8a3266796b41d197068d7ef7fbb/README.md
Suppose I have 2 tables: Page
and PageTranslation
If I use your behavior and use
localized()
query, it gives me error of unknown attribute. I've found out that I need to overload Modelattributes()
function and addtitle
andcontent
as virtual attributes for the behavior to work.Why not create virtual attributes in behavior if they are not found, or maybe at least add this in documentation.
P.S. Thanks for this behavior for our beloved PHP framework.