/** * Get all DAO classes. */ public function getAllDAO() { $classList = CRM_Core_DAO_AllCoreTables::getClasses(); $return = array(); foreach ($classList as $class) { $return[] = array($class); } return $return; }
/** * Get all DAO classes. */ public function getAllDAO() { $this->setUp(); // Ugh. Need full bootstrap to enumerate classes. $classList = CRM_Core_DAO_AllCoreTables::getClasses(); $return = array(); foreach ($classList as $class) { $return[] = array($class); } return $return; }
/** * List all tables which have hard foreign keys to this table. * * For now, this returns a description of every entity_id/entity_table * reference. * TODO: filter dynamic entity references on the $tableName, based on * schema metadata in dynamicForeignKey which enumerates a restricted * set of possible entity_table's. * * @param string $tableName * Table referred to. * * @return array * structure of table and column, listing every table with a * foreign key reference to $tableName, and the column where the key appears. */ public static function getReferencesToTable($tableName) { $refsFound = array(); foreach (CRM_Core_DAO_AllCoreTables::getClasses() as $daoClassName) { $links = $daoClassName::getReferenceColumns(); $daoTableName = $daoClassName::getTableName(); foreach ($links as $refSpec) { /** @var $refSpec CRM_Core_Reference_Interface */ if ($refSpec->matchesTargetTable($tableName)) { $refsFound[] = $refSpec; } } } return $refsFound; }
/** * List all tables which have hard foreign keys to this table. * * For now, this returns a description of every entity_id/entity_table * reference. * TODO: filter dynamic entity references on the $tableName, based on * schema metadata in dynamicForeignKey which enumerates a restricted * set of possible entity_table's. * * @param string $tableName table referred to * * @return array structure of table and column, listing every table with a * foreign key reference to $tableName, and the column where the key appears. */ static function getReferencesToTable($tableName) { $refsFound = array(); foreach (CRM_Core_DAO_AllCoreTables::getClasses() as $daoClassName) { $links = $daoClassName::getReferenceColumns(); $daoTableName = $daoClassName::getTableName(); foreach ($links as $refSpec) { if ($refSpec->getTargetTable() === $tableName or $refSpec->isGeneric()) { $refsFound[] = $refSpec; } } } return $refsFound; }