I have not been able to chase down a clear answer to this yet. I have not done much work with relationships with any more than 2 tables with Yii so this is not something I have had to deal with yet.
I have 3 tables:
product -> product_data <- product_data_source
product HAS_MANY product_data
product_data_source HAS_MANY product_data
There is a many-to-one relationship here so I know that I will need to handle the results as an array. I want to return data from both tables for product_id 99:
$product = Product::model()->with('productData', 'productData.productDataSource') -> findByPk(99);
$productData = $product -> productData; // This will get me the result from the product_data_table
$productDataSource = $product -> productDataSource; // Does not work
I would then handle $product_data using a foreach.
However, this produces the error:
Property "McgProduct.productDataSource" is not defined.
How do I reference the result from the product_data_source table? The following is clearly wrong:
$productDataSource = $product -> productDataSource;