mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
Do not overwrite __construct() in forms, there's init() for that purpose
refs #5525
This commit is contained in:
parent
c36e30af1e
commit
d260c3fb94
@ -20,19 +20,27 @@ class DbBackendForm extends BaseBackendForm
|
|||||||
*/
|
*/
|
||||||
protected $resources;
|
protected $resources;
|
||||||
|
|
||||||
public function __construct()
|
/**
|
||||||
|
* Initialize this form
|
||||||
|
*
|
||||||
|
* Populates $this->resources.
|
||||||
|
*
|
||||||
|
* @throws ConfigurationError In case no database resources can be found
|
||||||
|
*/
|
||||||
|
public function init()
|
||||||
{
|
{
|
||||||
$dbResources = array_keys(
|
$dbResources = array_keys(
|
||||||
ResourceFactory::getResourceConfigs('db')->toArray()
|
ResourceFactory::getResourceConfigs('db')->toArray()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (empty($dbResources)) {
|
if (empty($dbResources)) {
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
t('There are no database resources')
|
t('There are no database resources')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->resources = array_combine($dbResources, $dbResources);
|
|
||||||
|
|
||||||
parent::__construct();
|
// array_combine() is necessary in order to use the array as select input data
|
||||||
|
$this->resources = array_combine($dbResources, $dbResources);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createElements(array $formData)
|
public function createElements(array $formData)
|
||||||
|
@ -21,19 +21,27 @@ class LdapBackendForm extends BaseBackendForm
|
|||||||
*/
|
*/
|
||||||
protected $resources;
|
protected $resources;
|
||||||
|
|
||||||
public function __construct()
|
/**
|
||||||
|
* Initialize this form
|
||||||
|
*
|
||||||
|
* Populates $this->resources.
|
||||||
|
*
|
||||||
|
* @throws ConfigurationError In case no database resources can be found
|
||||||
|
*/
|
||||||
|
public function init()
|
||||||
{
|
{
|
||||||
$ldapResources = array_keys(
|
$ldapResources = array_keys(
|
||||||
ResourceFactory::getResourceConfigs('ldap')->toArray()
|
ResourceFactory::getResourceConfigs('ldap')->toArray()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (empty($ldapResources)) {
|
if (empty($ldapResources)) {
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
t('There are no LDAP resources')
|
t('There are no LDAP resources')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->resources = array_combine($ldapResources, $ldapResources);
|
|
||||||
|
|
||||||
parent::__construct();
|
// array_combine() is necessary in order to use the array as select input data
|
||||||
|
$this->resources = array_combine($ldapResources, $ldapResources);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createElements(array $formData)
|
public function createElements(array $formData)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user