I am developing a sample app and would like your input on something. I currently have 2 models, Products and ProductSpecialPrices, products has a hasMany relationship to ProductSpecialPrices and ProductSpecialPrices has a belongsTo relationship to Products.
ProductSpecialPrices' fields include productid (from Products), special-price and userId. Each userId can have many ProductSpecialPrices records, one for each productId. So here comes the question:
When querying the Products model, I also want to get the related records based on the userId I specify. I read somewhere that I can specify parameters to the relationship, but I cannot find documentation for this. On plain SQL, I would need to do something like this:
SELECT * FROM Products INNER JOIN ProductSpecialPrices ON ProductSpecialPrices.productId = Product.id WHERE userId = XX
The resulting Products would be presented in a simple view.
P.S. This is a sample app to help me familiarize with more advanced Phalcon techniques, so a simple example will help...