developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 12 years ago

Last modified 5 years ago

#648 confirmed bug

class dao factory , bug when generating parameter with default value

Reported by: samtahRam Owned by: samtahRam
Priority: normal Milestone:
Component: jelix:dao Version: 1.0.4
Severity: major Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

i want to attract your attention about a bug when we declare a method in the xml file of which parameters are initialized with default values. indeed, after the generating process, the parameters type are systematically in string, the others types like boolean aren't set at all. For instances, in our xml

<method type="php" name="test">

<parameter name="a" default="null" /> <parameter name="b" default="false" /> <body><![CDATA[ ]]></body>

</method>

the method that we obtain is something like this

public function test ($a='null',$b='false'){

}

Change History (8)

comment:1 Changed 50 years ago by laurentj

  • Milestone changed from Jelix 1.6.0 to Jelix 1.6.1pre

comment:1 Changed 12 years ago by laurentj

  • Priority changed from high to normal
  • Type changed from bug to enhancement

This is not a bug. It generates string because there is no way here to know the type of the default value. jDao cannot guess if you mean "null" or null.

We could support other attributes for specific type of values...

comment:2 Changed 8 years ago by laurentj

  • Status changed from new to confirmed
  • Type changed from enhancement to bug

comment:3 Changed 8 years ago by foxmask

Laurentj ; how do you prefer we handle this :

with a list of known types like true/false/null specially when the method is "php" ?

comment:4 Changed 8 years ago by laurentj

I suggest

<parameter name="a" default="null" type="null"/>

or "boolean", "integer", "float" ...

comment:5 Changed 7 years ago by laurentj

  • Milestone set to Jelix 1.5

comment:6 Changed 7 years ago by laurentj

  • Milestone changed from Jelix 1.5 to Jelix 1.6

comment:7 Changed 5 years ago by laurentj

  • Milestone Jelix 1.6.1pre deleted

Milestone Jelix 1.6.1pre deleted

Note: See TracTickets for help on using tickets.