comanage-dev - [comanage-dev] r486 - in registry/trunk/app: Model Plugin/ChangelogProvisioner/Model Plugin/LdapProvisioner/Model
Subject: COmanage Developers List
List archive
[comanage-dev] r486 - in registry/trunk/app: Model Plugin/ChangelogProvisioner/Model Plugin/LdapProvisioner/Model
Chronological Thread
- From:
- To:
- Subject: [comanage-dev] r486 - in registry/trunk/app: Model Plugin/ChangelogProvisioner/Model Plugin/LdapProvisioner/Model
- Date: Sun, 7 Apr 2013 16:42:05 -0400
- Authentication-results: sfpop-ironport04.merit.edu; dkim=neutral (message not signed) header.i=none
Author: benno
Date: 2013-04-07 16:42:05 -0400 (Sun, 07 Apr 2013)
New Revision: 486
Modified:
registry/trunk/app/Model/AppModel.php
registry/trunk/app/Plugin/ChangelogProvisioner/Model/ChangelogProvisioner.php
registry/trunk/app/Plugin/ChangelogProvisioner/Model/CoChangelogProvisionerExport.php
registry/trunk/app/Plugin/LdapProvisioner/Model/CoLdapProvisionerDn.php
registry/trunk/app/Plugin/LdapProvisioner/Model/LdapProvisioner.php
Log:
Cascade delete into plugins (CO-519)
Modified: registry/trunk/app/Model/AppModel.php
===================================================================
--- registry/trunk/app/Model/AppModel.php 2013-04-07 20:38:28 UTC (rev
485)
+++ registry/trunk/app/Model/AppModel.php 2013-04-07 20:42:05 UTC (rev
486)
@@ -34,6 +34,31 @@
* @package registry
*/
class AppModel extends Model {
+ public function beforeDelete($cascade = true) {
+ if($cascade) {
+ // Load any plugins and figure out which (if any) have foreign keys to
belongTo this model
+
+ foreach(App::objects('plugin') as $p) {
+ $pluginModel = ClassRegistry::init($p . "." . $p);
+
+ if(!empty($pluginModel->cmPluginHasMany)
+ && !empty($pluginModel->cmPluginHasMany[ $this->name ])) {
+ foreach($pluginModel->cmPluginHasMany[ $this->name ] as $fkModel) {
+ $assoc = array();
+ $assoc['hasMany'][ $fkModel ] = array(
+ 'className' => $fkModel,
+ 'dependent' => true
+ );
+
+ $this->bindModel($assoc, false);
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
/**
* For models that support Extended Types, obtain the default types.
*
Modified:
registry/trunk/app/Plugin/ChangelogProvisioner/Model/ChangelogProvisioner.php
===================================================================
---
registry/trunk/app/Plugin/ChangelogProvisioner/Model/ChangelogProvisioner.php
2013-04-07 20:38:28 UTC (rev 485)
+++
registry/trunk/app/Plugin/ChangelogProvisioner/Model/ChangelogProvisioner.php
2013-04-07 20:42:05 UTC (rev 486)
@@ -29,4 +29,9 @@
// Expose Menu Items
public $cmPluginMenus = array();
+
+ // Document foreign keys
+ public $cmPluginHasMany = array(
+ "CoPerson" => array("CoChangelogProvisionerExport")
+ );
}
Modified:
registry/trunk/app/Plugin/ChangelogProvisioner/Model/CoChangelogProvisionerExport.php
===================================================================
---
registry/trunk/app/Plugin/ChangelogProvisioner/Model/CoChangelogProvisionerExport.php
2013-04-07 20:38:28 UTC (rev 485)
+++
registry/trunk/app/Plugin/ChangelogProvisioner/Model/CoChangelogProvisionerExport.php
2013-04-07 20:42:05 UTC (rev 486)
@@ -1,6 +1,6 @@
<?php
/**
- * COmanage Registry CO LDAP Provisioner Export Model
+ * COmanage Registry CO Changelog Provisioner Export Model
*
* Copyright (C) 2013 University Corporation for Advanced Internet
Development, Inc.
*
@@ -30,7 +30,10 @@
public $actsAs = array('Containable');
// Association rules from this model to other models
- public $belongsTo =
array("ChangelogProvisioner.CoChangelogProvisionerTarget");
+ public $belongsTo = array(
+ "ChangelogProvisioner.CoChangelogProvisionerTarget",
+ "CoPerson"
+ );
// Default display field for cake generated views
public $displayField = "exporttime";
Modified:
registry/trunk/app/Plugin/LdapProvisioner/Model/CoLdapProvisionerDn.php
===================================================================
--- registry/trunk/app/Plugin/LdapProvisioner/Model/CoLdapProvisionerDn.php
2013-04-07 20:38:28 UTC (rev 485)
+++ registry/trunk/app/Plugin/LdapProvisioner/Model/CoLdapProvisionerDn.php
2013-04-07 20:42:05 UTC (rev 486)
@@ -30,7 +30,10 @@
public $actsAs = array('Containable');
// Association rules from this model to other models
- public $belongsTo = array("LdapProvisioner.CoLdapProvisionerTarget");
+ public $belongsTo = array(
+ "LdapProvisioner.CoLdapProvisionerTarget",
+ "CoPerson"
+ );
// Default display field for cake generated views
public $displayField = "dn";
Modified: registry/trunk/app/Plugin/LdapProvisioner/Model/LdapProvisioner.php
===================================================================
--- registry/trunk/app/Plugin/LdapProvisioner/Model/LdapProvisioner.php
2013-04-07 20:38:28 UTC (rev 485)
+++ registry/trunk/app/Plugin/LdapProvisioner/Model/LdapProvisioner.php
2013-04-07 20:42:05 UTC (rev 486)
@@ -28,4 +28,9 @@
// Expose Menu Items
public $cmPluginMenus = array();
+
+ // Document foreign keys
+ public $cmPluginHasMany = array(
+ "CoPerson" => array("CoLdapProvisionerDn")
+ );
}
- [comanage-dev] r486 - in registry/trunk/app: Model Plugin/ChangelogProvisioner/Model Plugin/LdapProvisioner/Model, svnlog, 04/07/2013
Archive powered by MHonArc 2.6.16.