Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Bug Reports » Enum Type and 0 index.
Re: Enum Type and 0 index. [message #397 is a reply to message #391] Tue, 14 November 2006 07:57 Go to previous messageGo to previous message
johandewit is currently offline  johandewit
Messages: 25
Registered: May 2006
Location: Belgium
Junior Member
    function _cm_getExtraData ($where, $fieldarray)
    // Perform custom processing for the getExtraData method.
    // $where = a string in SQL 'where' format.
    // $fieldarray = the contents of $where as an array.
    {
        $this->lookup_data['input_state'] = $this->fieldspec['input_state']['values'];



I believe above code is the source. Using above code is an indexec array, while your lookup array is an associative one.
Your code will work because the 'abnormal' behaviour of the in_array only occurs whenusing indexed array, end only if index = '0'.

I've used above statement to fill up the lookup data because i do not have to change the code if the enumaration is changed in the database. This is done by the regeneration of the dict file.

I also uses the enum type here because depending on the contents of that field, I have to process the data in a specific and/or different way.

This interpretation of the enum type was also the reason to use the fieldspec['enumfield']['values'] directly in the std.validation.class.inc instead of the call
$enum = $this->caller->getValRep($fieldname)

because the fieldspec is passed as a parameter.

The getEnum on the other hand, retreives the enum values from the database.

I'm a little confused now about the prefered way to work with the enumaration type.








 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: std.batch.inc
Next Topic: setOrderBy function working incorrectly
Goto Forum:
  


Current Time: Sun Nov 24 19:43:56 EST 2024

Total time taken to generate the page: 0.01219 seconds