I'm working on a reasonably large Laravel project and am using Repositories.
I have a user repository which injects its dependencies like so:
public function __construct(CartRepository $cartRepo...)
This causes the following error:
Maximum function nesting level of '100' reached, aborting!
I think this is because the CartRepo injects an ItemRepo which in turn injects the UserRepo, causing an infinite nesting loop.
What I don't get is how to find away around this, the ItemRepo needs the UserRepo as items are tied to a user?
Has anyone come across this before? If so how'd you get around it?
I know I can increase xdebug.max_nesting_level
but even with a value of 750 it's still throwing an error, I'd also rather fix the underlying problem than just bury it.