Reputation: 55
I have a DepartmentsWokplans Model that belongs to only one CoprprateWorkPlan. The CorporateWorkPlan Model has many CorporateStrategicObjectives. Using a DepartmentWorkplanId, I'm able to the CoprporateStatergicObjectives using the code I have shared Below but only the Ids. My problem is how do I get more details about the CoprporateStatergicObjectives (Eg Description, ETC) which are stored in another table using the Id's that I have?
DepartmentWorkPlansModel = DepartmentWorkPlans::findOne($DepartmentWorkPlanId);
$CorporateObjectives = $DepartmentWorkPlansModel->corporateWorkPlan->corporateStrategicObjectives;
//How Do I get more Details about the CorporateObjectives?
Results I'm getting when I Print_r($CorporateObjectives)
Array
(
[0] => common\models\CorporateStrategicObjectives Object
(
[_attributes:yii\db\BaseActiveRecord:private] => Array
(
[CorporateObjectiveId] => 1
[CorporateWorkPlanId] => 5
[StrategicObjectiveId] => 5
)
[_oldAttributes:yii\db\BaseActiveRecord:private] => Array
(
[CorporateObjectiveId] => 1
[CorporateWorkPlanId] => 5
[StrategicObjectiveId] => 5
)
[_related:yii\db\BaseActiveRecord:private] => Array
(
)
[_relationsDependencies:yii\db\BaseActiveRecord:private] => Array
(
)
[_errors:yii\base\Model:private] =>
[_validators:yii\base\Model:private] =>
[_scenario:yii\base\Model:private] => default
[_events:yii\base\Component:private] => Array
(
)
[_eventWildcards:yii\base\Component:private] => Array
(
)
[_behaviors:yii\base\Component:private] => Array
(
)
)
Upvotes: 0
Views: 33