Skip to content

CFM-53_External_Identity_Source_Plugins_ASSOCIATED_MODELS_COID #140

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions app/src/Controller/ExternalIdentitySourcesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,32 @@
use Cake\ORM\TableRegistry;

class ExternalIdentitySourcesController extends StandardPluggableController {
/**
* Perform Cake Controller initialization.
*
* @since COmanage Registry v5.0.0
*/

public function initialize(): void {
parent::initialize();

// We need to manually set the Current CO ID for models with dynamic
// validation rules. This is ordinarily done by AppController, but
// AppController doesn't know how to figure out what CO an API request
// maps to. Plugins can implement calculateRequestedCOID() to tell
// AppController what the current CO is, we then pass that information
// manually here.

// It's not ideal to have a hardcoded list of models, but we don't have
// a better solution at the moment.

foreach(['Addresses', 'Names', 'TelephoneNumbers'] as $m) {
$Table = TableRegistry::getTableLocator()->get($m);

$Table->setCurCoId($this->getCOID());
}
}

public $paginate = [
'order' => [
'ExternalIdentitySources.description' => 'asc'
Expand Down