Answer the question
In order to leave comments, you need to log in
How to create a link with a condition?
Hi friends.
There is a table of goods (sku): id, sku, title
And there is a table of prices (sku_costs): id, sum, datefrom
In the table of prices, the chronology of prices for each product. The current price of the product should be pulled out by the maximum datefrom (datetime) and id.
Question: How can I display this relationship in the search model?
In the Sku model, I declare the relationship like this:
public function getCost()
{
return $this->hasOne(SkuCosts::className(), ['id' => 'id']);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question