Hi everyone!
I have small problem. If is it duplicate of some other topic I am sorry from top.
I have two models: Auctions and Items and obviously these models have relation.
Auctions.php
public function initialize()
{
$this->belongsTo('char_id', 'Characters', 'id', array('alias' => 'Characters'));
$this->belongsTo('item_id', 'Items', 'id', array('alias' => 'Items'));
$this->belongsTo('winner_id', 'Character', 'id', array('alias' => 'Winner'));
}
Items.php
public function initialize()
{
$this->hasMany('id', 'TeamsItems', 'item_id', array('alias' => 'TeamItems'));
$this->hasMany('id', 'ItemsStats', 'item_id', array('alias' => 'ItemsStats'));
$this->hasMany('id', 'Loot', 'item_id', array('alias' => 'Loot'));
$this->hasMany('id', 'CharsItems', 'item_id', array('alias' => 'CharsItems'));
$this->hasMany('id', 'Auctions', 'item_id', array('alias' => 'Auctions'));
}
And here I have code of my controller to these:
$items = Auctions::find(array(
'Items.id = 1'
));
All of that unfortunately give me something like this:
Unknown model or alias 'Items' (11), when preparing: SELECT [Auctions].* FROM [Auctions] WHERE Items.id = 1
Here is my question. Can I do this way or maybe there is more complicated but running solution?
Thanks for answers