Search the Community
Showing results for tags 'models'.
Hi. I'm working on building my first processwire site, and I want to make sure I'm getting it right. I'd appreciate any feedback. I have a `vendor.php` template/model that will contain companies. I need to give users the ability to rate (1-5) that vendor. So I think I need to build a `vendor_rating.php` model/template with fields `rating` (int), `user` (ref), `vendor` (ref), and perhaps a textarea for `review`. Then, in the vendor template I will call and cache the average vendor rating for display. I don't actually want to display the individual ratings anywhere, so I guess I still need to figure out how to do an ajax call from the front end. ### Here's the thing. This structure is almost identical to "comments" with only one extra field for the `rating`. So should I just extend that in some way? Or stick to my current path and make a new model/template? Thanks!
I have a friend who uses Silverstripe, and he was telling me about the Data Objects and the ORM it uses, for things like "has many", "one to one", "one to many" relations etc. Maybe i'm not thinking about things correctly, but in the Processwire world, would a Page essentially be a data object? Just want to get my head around how to think about structuring a web application in Processwire. I'm familiar with traditional MVC (rails, code igniter) based structures. The API may already enable this kind of functionality, but i was wondering if not, would Processwire ever get an ORM? or can an ORM be bolted onto Processwire? If anyone could help me figure this out that'd be great. Thanks