Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2008-02-06 Thread Baz L
There 'work around' doesn't exactly work: I'd have to override schema() in my model to add the fields. Then I could manually call deconstruct(). However, overriding schema will be done for ALL of the model's functions. I would then get problems when performing find('all'), etc. On Jan 13, 2:00

Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2008-01-13 Thread [EMAIL PROTECTED]
Try: $property_formatted_date_string = $this-Model-deconstruct($this- data['Model']['datefield']); When you're saving data, it seems to work fine without calling Model::deconstruct, but if you're doing 'custom' date fields (e.g., searching records in a database) it appears that you need to

Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2007-12-11 Thread Baz
In one of the latest SVN versions of CakePHP this seems to have been redone. It now returns: ['to']['year'] ['to']['month'] ['to']['day'] cleanUpFields is gone. It should be done automatically through the model, BUT I can't get it to save to the database. Out well. On Dec 5, 2007 9:51 PM, Baz

Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2007-12-11 Thread Gwoo
What does it say cleanUpFields() was replaced by? Maybe you could use that --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To

Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2007-12-11 Thread Samuel DeVore
Model::deconstruct() I think http://api.cakephp.org/1.2/class_model.html#0198f3999e2942f8e82db80fc9e19c30 :) Sam D On Dec 11, 2007 8:33 AM, Gwoo [EMAIL PROTECTED] wrote: What does it say cleanUpFields() was replaced by? Maybe you could use that -- (the old fart) the advice is

Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2007-12-11 Thread Baz
Yeah, I saw that... And I also saw something that said this is called through Model::set(). But, I'm still lost as to how to use it. Also, what I did was I got the latest SVN and I just did a bake on a simple database with a date field. Long story short, it doesn't work. I think I'll just

Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2007-12-11 Thread Baz
It says it was replaced by: Model::deconstruct() But the functionality is different. Doing a direct call didn't work for me. Even if it did, there's another issue with the latest version not saving dates and times to the database. I think I'll just hold up on the SVN for now. At least until they

Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2007-12-05 Thread Adam Royle
Is it a big deal to not have them in the database? Maybe if I understood the context a bit better then I might be able to suggest something more appropriate. In my forms when I have datetime fields, I separate them off into two fields - date as d/m/y and time as any string strtotime() handles.

Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2007-12-05 Thread Baz
Sorry AD, you've totally lost me. -- Baz L Web Development 2.0: Web Design, CakePHP, Javascript http://www.WebDevelopment2.com/ On Dec 5, 2007 5:09 AM, AD7six [EMAIL PROTECTED] wrote: On Dec 5, 8:57 am, Baz [EMAIL PROTECTED] wrote: OK, I've banged my head against the wall a million

Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2007-12-05 Thread Adam Royle
With AD's technique (which looks kinda cool), you would still need to write a custom method to handle the data conversion from your date input to an sql datetime. All depends on your form I guess. Since I'm in Australia, I want to convert my form fields from dd/mm/ (aus format) to

Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2007-12-05 Thread AD7six
On Dec 5, 8:57 am, Baz [EMAIL PROTECTED] wrote: OK, I've banged my head against the wall a million times. This is my problem: I got date and time fields which I need. They are not associated with the model or database. I call them like so: echo $form-input('from',

Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2007-12-05 Thread Baz
Ouch, ok. My *actual* problem is specific to time however: [1]:[02] [AM] becomings - [1]:[2] in $this-data. Therefore, becoming 1:2am in my string and causing me strtotime to fail. OK, I'll just use my own fields. I just thought there was a simpler method. Just figured if it's there, I should be

Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2007-12-05 Thread Baz
My thinking is if there's already a function there, maybe there's someway I can use it without doing my own. I'm tried concatinating the fields, but that didn't work so well (stuff like 1:02 am, for some reason becomes 1:2 am and then strtotime doesn't work). -- Baz L Web Development 2.0: Web

Re: Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2007-12-05 Thread Baz
Hey, thanX for all the help people. I took the lazy way out though. I copied a huge chunk outta cleanUpFields. Actually, it's more like I removed the loops. So now I got this: function cleanUpField($field, $type, $modelClass = null) And I call it like: $this-cleanUpFiend('to', 'date');

Saving Date and Time NOT in the Model/Database (cleanUpFields not working)

2007-12-04 Thread Baz
OK, I've banged my head against the wall a million times. This is my problem: I got date and time fields which I need. They are not associated with the model or database. I call them like so: echo $form-input('from', array('label' = 'From', 'type' = 'date', 'div' = 'date'));