You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'eavAttr' => array(
'class' => 'application.components.behaviors.EEavBehavior',
'tableName' => 'project_eav',
'entityField' => 'project_id',
'safeAttributes' => [], //empty array! btw, I have three eav-fields for this model
'preload' => false, //preload false!
'cacheId' => 'cache'
)
i have three attributes stored in db for Model->id instance:
attribute1=OK
attribute2=OK
attribute3=OK
Now, you should turn on CMemCache etc,
then make flush_all; //!important
and use in template smth like this:
$appealText = $this->project->getEavAttribute('attribute1'); //it's OK!
$appealText = $this->project->getEavAttribute('attribute2'); //it's NULL!
$appealText = $this->project->getEavAttribute('attribute3'); //it's NULL!
Thats all folks! you have a broken cache data!
The possible solution are following:
do not use 'safeAttributes' => [], with empty array
public function getEavAttribute($attribute) {
$values = $this->getEavAttributes(array($attribute)); //storing to cache only the first value!
return $this->attributes->itemAt($attribute);
}
The text was updated successfully, but these errors were encountered:
Model.php:
i have three attributes stored in db for Model->id instance:
attribute1=OK
attribute2=OK
attribute3=OK
Now, you should turn on CMemCache etc,
then make flush_all; //!important
and use in template smth like this:
$appealText = $this->project->getEavAttribute('attribute1'); //it's OK!
$appealText = $this->project->getEavAttribute('attribute2'); //it's NULL!
$appealText = $this->project->getEavAttribute('attribute3'); //it's NULL!
Thats all folks! you have a broken cache data!
The possible solution are following:
before getting the first one!
The root of evil is:
The text was updated successfully, but these errors were encountered: