I'm just getting started with php-activerecord and I was hoping someone could help me with an issue. I'm trying to create a utility application to track application dependencies in our hosting environment. Here is the scenario. I have many applications. Each application can have many other applications that depend on it. In addition, there may be many applications that this app depends on. I have two tables:
apps:
id
appname
And a 'dependents' table:
dependents:
id
app_id
dependent_id
What I'd ultimately like to be able to do is call the following in order to get an array of dependent app objects:
1App::find(1)->dependents;
And the following in order to get providers (an array of app object that this app depends on which would still be joined through the dependents table):
1App::find(1)->providers;
I haven't gotten far, but I've tried the following just to get started but can't get any results:
I'm sure this will be a combination of $has_many (through) but I can't seem to get it working. Any assistance anyone could offer would be very much appreciated.
Subject: Self association problem
Hey,
I'm just getting started with php-activerecord and I was hoping someone could help me with an issue. I'm trying to create a utility application to track application dependencies in our hosting environment. Here is the scenario. I have many applications. Each application can have many other applications that depend on it. In addition, there may be many applications that this app depends on. I have two tables:
And a 'dependents' table:
What I'd ultimately like to be able to do is call the following in order to get an array of dependent app objects:
And the following in order to get providers (an array of app object that this app depends on which would still be joined through the dependents table):
I haven't gotten far, but I've tried the following just to get started but can't get any results:
I'm sure this will be a combination of $has_many (through) but I can't seem to get it working. Any assistance anyone could offer would be very much appreciated.
Keith