[eluser]7amza[/eluser]
hey ,
i have a small problem .
my database structure:
portals(parent): id title created ..
categories(child) : id portal_id title..
pages(child) : id portal_id title..
portal.php(model) :
function __construct($id = NULL)
{
parent::__construct($id);
}
}
category.php
Code:
<?php
class Category extends DataMapper {
var $table = "categories";
var $has_one = array("portal");
var $has_many = array("article");
function __construct($id = NULL)
{
parent::__construct($id);
}
}
page.php
Code:
<?php
class Page extends DataMapper {
var $table = "pages";
var $has_one = array(
"portal" => array(
'class' => 'portal',
'other_field' => 'portal')
);
function __construct($id = NULL)
{
parent::__construct($id);
}
}
so when i use relationship between categories and portal($category->portal->title) it works fine but when i try to get relationship between pages and portal($page->portal->title) it didn't work , i get the following error :
Quote:DataMapper Error: 'page' is not a valid parent relationship for Portal. Are your relationships configured correctly?
i wrote the manual especially the item #4 that's try to solve the problem but i didn't get a solution .