Sorry let me rewrite my q. again more accurately:

Here is a real example.  Having already loaded all
products with Rose, I now want to see how many of a product are at a
particular location which comes from a one_to_many
relationship with another table "locations".  With my old
hash method of doing this it would be trivially simple:
$product{locations}{$location}{stockqty}.

I thought it would be trivially simple with Rose too but it
doesn't seem to be.

$products = MG::Product::Manager->get_products(require_objects =>
['locations']);

So now $products is an array of all product information, just
like %product was a hash of all product info.  But how do I
elegantly get that stock quantity info for a particular location
out of the $products array?  I need something like:

foreach $prod (@$products) {
        $prod->locations->$location->stockqty
        or
        $prod->locations(locationcode => $location)->stockqty
        }

Is there a oneliner solution?

Or do I just have to do another call to the DB or simply iterate through
locations?

thanks,

James.




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to