Rev 1 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
<?phpdeclare(strict_types=1);namespace LeadersLinked\Form\MyGroup;use Laminas\Form\Form;use Laminas\Db\Adapter\AdapterInterface;use Laminas\Log\LoggerInterface;use LeadersLinked\Mapper\CompanySizeMapper;use LeadersLinked\Mapper\IndustryMapper;class IndustryForm extends Form{/**** @param AdapterInterface $adapter*/public function __construct($adapter){parent::__construct();$this->setInputFilter(new IndustryFilter($adapter));$this->add(['name' => 'industry_id','type' => \Laminas\Form\Element\Select::class,'options' => ['value_options' => $this->optionsIndustry($adapter),],'attributes' => ['id' => 'industry_id',]]);}/**** @param AdapterInterface $adapter* @return array*/private function optionsIndustry($adapter){$industryMapper = IndustryMapper::getInstance($adapter);$industries = $industryMapper->fetchAllActive();$options = [];foreach($industries as $industry){$options[$industry->uuid] = $industry->name;}return $options;}}