Skip to content

Commit

Permalink
AppController fix for ApiSource (CFM-115)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Jan 11, 2024
1 parent d117f5a commit 5941470
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions app/src/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,19 +554,19 @@ protected function setCO() {
approach below.
$CoIdEventListener = new CoIdEventListener($coid);
EventManager::instance()->on($CoIdEventListener);*/
}

// Walk through the first level associations and pass the CO ID to them,
// as well. We could ultimately cascade this via the table once we have
// a use case to do so, though note it's possible a child associations
// wants the CO ID even though the parent doesn't.

foreach($this->$modelsName->associations()->getIterator() as $a) {
$aTable = $a->getTarget();

if(method_exists($aTable, "acceptsCoId")
&& $aTable->acceptsCoId()) {
$aTable->setCurCoId((int)$coid);
// Walk through the first level associations and pass the CO ID to them,
// as well. We could ultimately cascade this via the table once we have
// a use case to do so, though note it's possible a child associations
// wants the CO ID even though the parent doesn't.

foreach($this->$modelsName->associations()->getIterator() as $a) {
$aTable = $a->getTarget();

if(method_exists($aTable, "acceptsCoId")
&& $aTable->acceptsCoId()) {
$aTable->setCurCoId((int)$coid);
}
}
}
}
Expand Down

0 comments on commit 5941470

Please sign in to comment.