[eluser]tpowalka[/eluser]
There is one more error.
Imagine three tables:
Code:
auctions
id
subjects
id
auctions_id
photos
id
subjects_id
there are two OneToMany definitions (in auctions.yml and subjects.yml)
Now, when I try to add new auction, it errors:
Code:
Error Number: 1054
Unknown column 'auctions_id' in 'where clause'
SELECT * FROM (`photos`) WHERE `auctions_id` = '1'
I found that error occurs in onetomany.php file. When working in subjects-photos scope (recursive, second call to OneToMany constructor), it gets the
initialized with
Code:
$this->CI->codexadmin->db_table;
(line 14 of onetomany.php file) (the value is 'auctions' - it doesn't take the fact, that it's a recursive call, and 'master' table is different - should have the value of 'subjects').
The fast workaround of this error is to follow this line with sth like this:
Code:
$master_table = substr($this->element_name, 0, strpos($this->element_name, '['));
if ($master_table != '')
$this->local_table = $master_table;
It allows to work with auctions. One can define subjects for auction. It only starts crashing when you try to add subject while adding auction.