public function actionSomething()
 {
     $product = new Product(['sku' => 5463, 'upc' => '234569', 'price' => 4.99, 'title' => 'Clue by four', 'description' => 'Used for larting lusers or constructing things', 'dimensions' => ['unit' => 'inch', 'width' => 4, 'height' => 2, 'length' => 20], 'material' => 'wood']);
     $product->save();
     /** @var Product $model */
     $model = new Product(['title' => 'Car', 'specs.fuel.tank.capacity' => 50, 'specs.fuel.tank.capacity.unit' => 'liter']);
     $model->setAttribute('specs.wheels.count', 4);
     $model = Product::find()->where(['(!dimensions.length!)' => 10]);
     $section = Product::find()->select('CONCAT((! dimensions.width !), " x ", (! dimensions.height !))')->where(['id' => 11])->one();
     $product = new Product();
     $product->specs = new TvSpecs(['scenario' => 'insert']);
     $product->specs->load(Yii::$app->request->post());
     if (!$model->validate()) {
         // process validation errors
     }
     $product->save(false);
     $thatTv = Product::findOne($product->id);
     \yii\helpers\VarDumper::dump($thatTv->specs);
     // $thatTv->specs equals $product->specs->toArray()
 }
 public function testUpdateAttributes()
 {
     parent::testUpdateAttributes();
     $product = Product::findOne(2);
     $this->assertTrue($product instanceof Product);
     $this->assertEquals(456, $product->int);
     $this->assertFalse($product->isNewRecord);
     //        $product->updateAttributes(['(!int!)' => 777]);
     //        $this->assertEquals(777, $product->int);
     //        $this->assertFalse($product->isNewRecord);
     //        $product2 = Product::findOne(2);
     //        $this->assertEquals(777, $product2->int);
     //        $this->assertInternalType('integer', $product2->int);
     //
     //        // update not eisting dynamic attribute
     //        $product = Product::findOne(3);
     //        $product->updateAttributes(['(!custom!)' => 'value']);
     //        $this->assertEquals('value', $product->custom);
     //        $this->assertFalse($product->isNewRecord);
     //        $product2 = Product::findOne(3);
     //        $this->assertEquals('value', $product2->custom);
 }
 public function testNestedSave()
 {
     $product = new Product();
     $product->person = new Person(['scenario' => 'all']);
     $product->person->load(self::$postInput);
     $this->assertTrue($product->save(false));
     $product2 = Product::findOne($product->id);
     $this->assertNotNull($product2);
     $this->assertEquals(self::$toArray, $product2->person);
 }