Bryan B Sun Nov 07 00:47:34 -0400 2010

Subject: [SOLVED] Using namespaces with has_many

I've tried looking around, but I cannot find a solution to this..

When I do: $productgroup = new Models\productgroup; it throws an error saying it cannot find the Product class.

namespace Models;
class productgroup extends \ActiveRecord\Model {
static $has_many = array(array('products'));
}
?>

Here is my config:
\ActiveRecord\Config::initialize(function ($cfg) {
$cfg->set_model_directory("/home/bezuka/public_html/api/models/");
$cfg->set_connections(array('development' => 'mysql://root:lzid83d@localhost/bezuka_api'));
});

the full paths to the files are:
/home/bezuka/public_html/api/models/models/productgroup.php
/home/bezuka/public_html/api/models/models/product.php
Assuming you create a folder for that namespace and it will include it from the correct path, and seems like what activerecord_autoload() is doing, however the class it trys loading is Product and not Models\Product

Soo lost now, if anyone can advise me of the correct procedure to perform such contraption, haha some humor for you, it will none the less be greatly appreciated.

Thank you, and to PHPAR, gold star man/women, and contributes alike. This is the most, simplistic yet powerful library I have used!!! besides this part, lmfao, i've gotta be doing something way wrong.. i know its my fault lol.
pulls out hair

Okay... yeah, it was solved, just realized, I probably needed to state the namespace inside of has_many lmfao. Thank you though.
puts hair back in