Welcome Guest, Not a member yet? Register   Sign In
Codeignier e datamapper one-to-many
#1

[eluser]Unknown[/eluser]
personal well'm doing a very simple system and I am with the following problem, I have 3 tables users, categories and posts, cata has a pos and a User category in the database tables have 5 post, User, category, post_usuario, categoria_post, when I access the users access works perfectly but when the category of the following error

Code:
DataMapper Error: 'categorium' is not a valid parent relationship for Post. Are your relationships configured correctly?

Code:
class Categoria extends DataMapper{

public  $table = 'categorias';
public $has_one = array('post');


public $default_order_by =  array('nome');



function __construct($id = null){
    parent::__construct($id = null);

}

}

class Post extends DataMapper{

public  $table = 'post';

public $default_order_by =  array('nome');
public $has_one = array('usuario','categoria');




function __construct($id = null){
    parent::__construct($id = null);


}

}

I'm trying

public function posts($id){

$cate = new Categoria($id);

Code:
$data['categoria'] = new Categoria();
$data['post'] = new Categoria($id);

print_r($cate->post->get_iterated());

}

but not work




Theme © iAndrew 2016 - Forum software by © MyBB