andWhere( [ 'status' => true, ] ); } public function joinOptions(bool $multiple = true) { return $this->with( [ 'productOptionCompls' => function ($query) { /** * @var ActiveQuery $query */ $query->with('lang.alias') ->with('group.lang'); }, ] ) ->with( [ 'productOptionExcls' => function ($query) { /** * @var ActiveQuery $query */ $query->with('lang.alias') ->with('group.lang'); }, ] ) ->with( [ $multiple ? 'variants' : 'variant' => function ($query) { /** * @var ActiveQuery $query */ $query->with('image') ->with( [ 'variantOptionCompls' => function ($query) { /** * @var ActiveQuery $query */ $query->with('lang.alias') ->with('group.lang'); }, ] ) ->with( [ 'variantOptionExcls' => function ($query) { /** * @var ActiveQuery $query */ $query->with('lang.alias') ->with('group.lang'); }, ] ); }, ] ); } /** * @inheritdoc * @return Product[]|array */ public function all($db = null) { return parent::all($db); } /** * @inheritdoc * @return Product|array|null */ public function one($db = null) { return parent::one($db); } }