
There are 7 different select widgets available. Except the Multiselect widgets, all of them are portrayed by an input field with a drop-down list of options. The database column type is VARCHAR for all select data types. The configured value (not the display value!) is stored in the database. In the case of multiselect, values are stored as a comma separated list. In order to set a select field's value programmatically, the value is simply passed to the setter. To set the values of a multiselect field, an array of values is passed to the setter.
$object->setSelect("1"); $object->setMultiselect(array("1","2")); $object->setLanguage("en"); $object->setCountry("AU"); $object->setUser(1); $object->save();
If one needs to find out what options are available for a select field. This can be done by getting the field definition as follows:
$fd = $object->getClass()->getFieldDefinition("multiselect");
$options = $fd->getOptions();
For select and multiselect the options can be defined with a value and display value in the class definition

Country and language have fixed option values. For the language field the options can be limited to available system languages. The country and language select field are also available as multi select fields.
The user field has fixed values as well. It allows to select a user from all available pimcore system users. Thereby a system user can be associated an object. This is explained in detail in the best practice about extending a pimcore user.
Comments (1)
Jun 08, 2011
Daniel Kipp says:
How do I get the "display name" from within my view script. <?= $object->...How do I get the "display name" from within my view script.
<?= $object->getSelectDataComponent() ?> // this returns the Value