Perhaps this will help: http://book.cakephp.org/view/657/Data-Type-Associations-by-Database
On May 27, 2:36 am, Bs <[email protected]> wrote: > Thanks. > What I'm missing is some kind of listing where it's clearly defined > which form field in cake is associated with which datatype in mysql. > > something like > > $form->input ---> varchar, text > $form->minute & hour --> datetime > $form->checkbox --> some kind of int field for setting "0" or "1" > > That's also a thing I still don't understand about the hour and minute > fields. Are they really associated with a "datetime" field in mysql? > Cause there's an actual "datetime" input type in cake forms and my > experiments with hour & minute form fields in cake and datetime > columns didn't work, yet. > > On May 27, 4:03 am, Brendon Kozlowski <[email protected]> wrote: > > > > > Although there are some discrepancies or missing inforrmation in the > > Cookbook, the nice thing is that we, as a community, can offer > > suggestions to improve it. It's basically a huge moderated Wiki (or > > integrated and web-based Trac system for documentation). > > ...either way, even without a definition in the method itself of what > > $options can be filled with, what you were passing it was still > > incorrect, based on the cookbook. The values you can trry to pass to > > the minute() or hour() methods can be found > > under:http://book.cakephp.org/view/189/Automagic-Form-Elements--see all > > the $options['..........'] descriptions. > > > As for alternative sources, there's also the API and you can search > > through the code to find the answers you need. (api.cakephp.org) > > > On May 26, 4:58 pm, Bs <[email protected]> wrote: > > > > Hi Brendon, > > > > the problem I have with the Cookbook is that many methods aren't > > > documented that well. The "minute" function for example...I couldn't > > > find any info what values are allowed for "attributes". The method is > > > just defined but not documented that well. > > > > On 26 Mai, 20:24, Brendon Kozlowski <[email protected]> wrote: > > > > > It doesn't look like you're using the FormHelper's methods properly. > > > > Looking at the API, and just the minute's method, I see it's > > > > incorrectly used. > > > > > function minute($fieldName, $selected = null, $attributes = array(), > > > > $showEmpty = true){ > > > > //... > > > > > } > > > > > Check the book (book.cakephp.org) and Core Helpers to understand how > > > > to use the Form methods with proper syntax and parameters. (I think > > > > you already have an idea of how to use them, but if it asks for an > > > > array, supply it with an array or you might get undesirable and > > > > unexpected results.) > > > > > On May 26, 12:24 pm, Bs <[email protected]> wrote: > > > > > > Hi Stu, > > > > > > I tried it out with "datetime" column but that doesn't work, either. > > > > > Result is "null" in the column. > > > > > Here's part of my code: > > > > > > add.cpt: > > > > > ... > > > > > <tr> > > > > > <td style="text-align:right;">Opening time</td> > > > > > <td style="text-align:left;">from <?php echo $form->hour > > > > > ('OpeningStartHours',1,6);?> : <?php echo $form->minute > > > > > ('OpeningStartMinutes',0,null,"00");?> > > > > > to <?php echo > > > > > $form->hour('OpeningEndHours', > > > > > 1,18);?> : <?php echo > > > > > $form->minute('OpeningEndMinutes',0,null,"00");?> o'clock > > > > > > </td> > > > > > </tr> > > > > > ... > > > > > > mycontroller: > > > > > .... > > > > > function add() { > > > > > .... > > > > > $startMinutes = $data['myobject']['OpeningStartMinutes']; > > > > > $startHours = $data['myobject']['OpeningStartHours']; > > > > > $endMinutes = $data['myobject']['OpeningEndMinutes']; > > > > > $endHours = $data['myobject']['OpeningEndHours']; > > > > > $data['myobject']['OpeningStartMinutes'] = $startMinutes['min']; > > > > > $data['myobject']['OpeningStartHours'] = $startHours['hour']; > > > > > $data['myobject']['OpeningEndMinutes'] = $endMinutes['min']; > > > > > $data['myobject']['OpeningEndHours'] = $endHours['hour']; > > > > > .... > > > > > > That way it works, but of course it's quite complicated always > > > > > converting those values and storing them in 4 different fields. > > > > > > After your hint I tried it with a datetime "OpeningStart" and > > > > > "OpeningEnd" field like this > > > > > ... > > > > > <tr> > > > > > <td style="text-align:right;">Opening time</td> > > > > > <td style="text-align:left;">from <?php echo $form->hour > > > > > ('OpeningStart',1,6);?> : <?php echo $form->minute('OpeningStart', > > > > > 0,null,"00");?> > > > > > to <?php echo > > > > > $form->hour('OpeningEnd',1,18);?> : > > > > > <?php echo $form->minute('OpeningEnd',0,null,"00");?> o'clock > > > > > </td> > > > > > </tr> > > > > > ... > > > > > > and commented out the conversion code in my controller, but that > > > > > resulted in "null" values for "OpeningStart" and "OpeningEnd" in the > > > > > database.- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
