AutorÃa | Ultima modificación | Ver Log |
<?phpdeclare(strict_types=1);namespace LeadersLinked\Form\UserProfile;use Laminas\Form\Form;use Laminas\Db\Adapter\AdapterInterface;use LeadersLinked\Mapper\HobbyAndInterestMapper;class HobbyAndInterestForm extends Form{/**** @param AdapterInterface $adapter*/public function __construct($adapter){parent::__construct();$this->setInputFilter(new HobbyAndInterestFilter($adapter));$this->add(['name' => 'hobbies_and_interests','type' => \Laminas\Form\Element\Select::class,'attributes' => ['multiple' => 'yes','id' => 'hobbies_and_interests',],'options' => ['disable_inarray_validator' => true,'value_options' => $this->getSelectOptions($adapter)]]);}/**** @param AdapterInterface $adapter*/private function getSelectOptions($adapter){$mapper = HobbyAndInterestMapper::getInstance($adapter);$records = $mapper->fetchAllActive();$items = [];foreach($records as $record){$items[$record->uuid] = $record->name;}return $items;}}