[Deprecated] DMZ 1.6.2 (DataMapper OverZealous Edition) |
[eluser]OverZealous[/eluser]
@GregX999 First off, that error means you either have misconfigured your relationships] or have [url=http://www.overzealous.com/dmz/pages/troubleshooting.html#General.Plural.Controller]a naming issue. Also, please see the top of the Troubleshooting page, and make sure you check each numbered item. Second, that query doesn't make sense. The query you ran would, if it didn't out-right error, always return 0 or 1, because you are querying the number of Products with an ID of $product_id. Also, you should never need to specify a table name in DMZ. That's usually a sign you are doing it wrong. ;-) So, what are you trying to query? E.g.: Number of categories for a given product: Code: $count = $category->where_related('product', 'id', $product_id)->count(); Edit: I forgot to include the cleaner alternative if you already have the $Product: Code: $count = $product->category->count(); |
Welcome Guest, Not a member yet? Register Sign In |