Exemplo n.º 1
0
 public function testCreateAttributes()
 {
     foreach ($this->dataAttr() as $values) {
         $attr = new EavAttribute();
         $attr->attributes = $values;
         $attr->save();
     }
     $this->assertEquals(EavAttribute::find()->count(), 3);
     $k = 0;
     foreach ($this->dataAttr() as $values) {
         $k++;
         foreach ($values as $key => $value) {
             $this->assertEquals(EavAttribute::findOne(['id' => $k])->{$key}, $value);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAttribute($name = '')
 {
     return $this->hasOne(EavAttribute::className(), ['id' => 'attributeId']);
 }
Exemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEavAttributes()
 {
     return $this->hasMany(EavAttribute::className(), ['categoryId' => 'categoryId']);
 }
Exemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEavAttributes()
 {
     return $this->hasMany(EavAttribute::className(), ['entityId' => 'id']);
 }
Exemplo n.º 5
0
 public function canGetProperty($name, $checkVars = true)
 {
     return EavAttribute::find()->where(['name' => $name])->exists();
 }