[eluser]cberk[/eluser]
From reading your code, it looks like you've converted the simple has_one and has_many arrays into more advanced ones, i.e. from single to multi-dimensional arrays. The PHP in_array function apparently has trouble with multi-dimensional arrays.
If I replace in_array() with array_key_exists(), I don't get that error anymore. This could be the solution, but I don't know what other parts of the file might also need to be updated.