Re: Can't get Save() to save certain fields

2008-05-19 Thread Joe

a i didn't know cakephp did caching of that sort! thank you so
much, that was what fixed it.

On May 16, 7:47 pm, francky06l <[EMAIL PROTECTED]> wrote:
> As Marcin think, to me it's caching problem . Delete files in tmp/
> cache/models or set debug > 0 in core.php :-)
>
> On May 17, 12:55 am, Stephen Orr <[EMAIL PROTECTED]> wrote:
>
> > I think it depends which Cake version you're using, but I'm pretty
> > sure now the preferred method of saving is:
>
> > $this->Model->create($this->data);
> > $this->Model->save();
>
> > I'm not sure if this changed between 1.1 and 1.2, but I'm using 1.2
> > and this technique works perfectly. I usually wrap it in a condition,
> > such as:
>
> > if($this->Model->create($this->data) && $this->Model->save()) {
> > // The information was saved} else {
>
> > // There was an error while saving - handle it here.
>
> > }
>
> > Hope that helps.
>
> > Steve
>
> > On May 16, 11:37 pm, "Marcin Domanski" <[EMAIL PROTECTED]> wrote:
>
> > > set debug to 1 so cake can refresh the cache,
> > > you _should_ debug with debug > 0 :)
>
> > > On Fri, May 16, 2008 at 11:17 PM, Joe <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > I'm having trouble with save() and was wondering if anyone could shed
> > > > some light on the problem. I inherited a project that has a page with
> > > > a form on it which updates information to a database upon submission.
> > > > It uses the save() method to update the data in the table, and it
> > > > works fine for all the fields that were on the form when I started
> > > > working on it. Now I'm trying to add a few new fields on the form and
> > > > in the database, but save() refuses to save my data. It still saves
> > > > every *other* field, just not my new ones. The line that saves the
> > > > data is simply:
> > > >   $this->Modelname->save($this->data, false);
>
> > > > I've print_r()'d $this->data, and the field names are in there just
> > > > fine. They exist in the database. There is no fields list in the call
> > > > to save() as you can see, and I tried turning validation off. I just
> > > > can't get it to work and it's rather frustrating.
>
> > > > I went into model_php5.php, and print_r()'d out $fields and $values
> > > > above this line:
> > > >if ($db->update($this, $fields, $values)) {
>
> > > > and my new fields are not in there. So I printed out the result of the
> > > > $this->hasField($x) test above the line:
> > > >   if ($this->hasField($x) && ($whitelist && in_array($x,
> > > > $fieldList) || !$whitelist)) {
>
> > > > and it fails for the fields not in there. So that makes sense. But the
> > > > ridiculously frustrating thing is that the fields *are in the
> > > > database*. In the table that belongs to the model. Same name, same
> > > > capitalizations. I just can't figure out what the problem here is...
> > > > does anyone have any idea?
>
> > > > Joe
>
> > > --
> > > Marcin Domanskihttp://kabturek.info

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Can't get Save() to save certain fields

2008-05-16 Thread francky06l

As Marcin think, to me it's caching problem . Delete files in tmp/
cache/models or set debug > 0 in core.php :-)

On May 17, 12:55 am, Stephen Orr <[EMAIL PROTECTED]> wrote:
> I think it depends which Cake version you're using, but I'm pretty
> sure now the preferred method of saving is:
>
> $this->Model->create($this->data);
> $this->Model->save();
>
> I'm not sure if this changed between 1.1 and 1.2, but I'm using 1.2
> and this technique works perfectly. I usually wrap it in a condition,
> such as:
>
> if($this->Model->create($this->data) && $this->Model->save()) {
> // The information was saved} else {
>
> // There was an error while saving - handle it here.
>
> }
>
> Hope that helps.
>
> Steve
>
> On May 16, 11:37 pm, "Marcin Domanski" <[EMAIL PROTECTED]> wrote:
>
> > set debug to 1 so cake can refresh the cache,
> > you _should_ debug with debug > 0 :)
>
> > On Fri, May 16, 2008 at 11:17 PM, Joe <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > I'm having trouble with save() and was wondering if anyone could shed
> > > some light on the problem. I inherited a project that has a page with
> > > a form on it which updates information to a database upon submission.
> > > It uses the save() method to update the data in the table, and it
> > > works fine for all the fields that were on the form when I started
> > > working on it. Now I'm trying to add a few new fields on the form and
> > > in the database, but save() refuses to save my data. It still saves
> > > every *other* field, just not my new ones. The line that saves the
> > > data is simply:
> > >   $this->Modelname->save($this->data, false);
>
> > > I've print_r()'d $this->data, and the field names are in there just
> > > fine. They exist in the database. There is no fields list in the call
> > > to save() as you can see, and I tried turning validation off. I just
> > > can't get it to work and it's rather frustrating.
>
> > > I went into model_php5.php, and print_r()'d out $fields and $values
> > > above this line:
> > >if ($db->update($this, $fields, $values)) {
>
> > > and my new fields are not in there. So I printed out the result of the
> > > $this->hasField($x) test above the line:
> > >   if ($this->hasField($x) && ($whitelist && in_array($x,
> > > $fieldList) || !$whitelist)) {
>
> > > and it fails for the fields not in there. So that makes sense. But the
> > > ridiculously frustrating thing is that the fields *are in the
> > > database*. In the table that belongs to the model. Same name, same
> > > capitalizations. I just can't figure out what the problem here is...
> > > does anyone have any idea?
>
> > > Joe
>
> > --
> > Marcin Domanskihttp://kabturek.info
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Can't get Save() to save certain fields

2008-05-16 Thread Stephen Orr

I think it depends which Cake version you're using, but I'm pretty
sure now the preferred method of saving is:

$this->Model->create($this->data);
$this->Model->save();

I'm not sure if this changed between 1.1 and 1.2, but I'm using 1.2
and this technique works perfectly. I usually wrap it in a condition,
such as:

if($this->Model->create($this->data) && $this->Model->save()) {
// The information was saved
} else {
// There was an error while saving - handle it here.
}

Hope that helps.

Steve

On May 16, 11:37 pm, "Marcin Domanski" <[EMAIL PROTECTED]> wrote:
> set debug to 1 so cake can refresh the cache,
> you _should_ debug with debug > 0 :)
>
>
>
> On Fri, May 16, 2008 at 11:17 PM, Joe <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm having trouble with save() and was wondering if anyone could shed
> > some light on the problem. I inherited a project that has a page with
> > a form on it which updates information to a database upon submission.
> > It uses the save() method to update the data in the table, and it
> > works fine for all the fields that were on the form when I started
> > working on it. Now I'm trying to add a few new fields on the form and
> > in the database, but save() refuses to save my data. It still saves
> > every *other* field, just not my new ones. The line that saves the
> > data is simply:
> >       $this->Modelname->save($this->data, false);
>
> > I've print_r()'d $this->data, and the field names are in there just
> > fine. They exist in the database. There is no fields list in the call
> > to save() as you can see, and I tried turning validation off. I just
> > can't get it to work and it's rather frustrating.
>
> > I went into model_php5.php, and print_r()'d out $fields and $values
> > above this line:
> >        if ($db->update($this, $fields, $values)) {
>
> > and my new fields are not in there. So I printed out the result of the
> > $this->hasField($x) test above the line:
> >       if ($this->hasField($x) && ($whitelist && in_array($x,
> > $fieldList) || !$whitelist)) {
>
> > and it fails for the fields not in there. So that makes sense. But the
> > ridiculously frustrating thing is that the fields *are in the
> > database*. In the table that belongs to the model. Same name, same
> > capitalizations. I just can't figure out what the problem here is...
> > does anyone have any idea?
>
> > Joe
>
> --
> Marcin Domanskihttp://kabturek.info
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Can't get Save() to save certain fields

2008-05-16 Thread Marcin Domanski

set debug to 1 so cake can refresh the cache,
you _should_ debug with debug > 0 :)

On Fri, May 16, 2008 at 11:17 PM, Joe <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm having trouble with save() and was wondering if anyone could shed
> some light on the problem. I inherited a project that has a page with
> a form on it which updates information to a database upon submission.
> It uses the save() method to update the data in the table, and it
> works fine for all the fields that were on the form when I started
> working on it. Now I'm trying to add a few new fields on the form and
> in the database, but save() refuses to save my data. It still saves
> every *other* field, just not my new ones. The line that saves the
> data is simply:
>   $this->Modelname->save($this->data, false);
>
> I've print_r()'d $this->data, and the field names are in there just
> fine. They exist in the database. There is no fields list in the call
> to save() as you can see, and I tried turning validation off. I just
> can't get it to work and it's rather frustrating.
>
> I went into model_php5.php, and print_r()'d out $fields and $values
> above this line:
>if ($db->update($this, $fields, $values)) {
>
> and my new fields are not in there. So I printed out the result of the
> $this->hasField($x) test above the line:
>   if ($this->hasField($x) && ($whitelist && in_array($x,
> $fieldList) || !$whitelist)) {
>
> and it fails for the fields not in there. So that makes sense. But the
> ridiculously frustrating thing is that the fields *are in the
> database*. In the table that belongs to the model. Same name, same
> capitalizations. I just can't figure out what the problem here is...
> does anyone have any idea?
>
> Joe
>
> >
>



-- 
Marcin Domanski
http://kabturek.info

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Can't get Save() to save certain fields

2008-05-16 Thread Joe

Hi,

I'm having trouble with save() and was wondering if anyone could shed
some light on the problem. I inherited a project that has a page with
a form on it which updates information to a database upon submission.
It uses the save() method to update the data in the table, and it
works fine for all the fields that were on the form when I started
working on it. Now I'm trying to add a few new fields on the form and
in the database, but save() refuses to save my data. It still saves
every *other* field, just not my new ones. The line that saves the
data is simply:
   $this->Modelname->save($this->data, false);

I've print_r()'d $this->data, and the field names are in there just
fine. They exist in the database. There is no fields list in the call
to save() as you can see, and I tried turning validation off. I just
can't get it to work and it's rather frustrating.

I went into model_php5.php, and print_r()'d out $fields and $values
above this line:
if ($db->update($this, $fields, $values)) {

and my new fields are not in there. So I printed out the result of the
$this->hasField($x) test above the line:
   if ($this->hasField($x) && ($whitelist && in_array($x,
$fieldList) || !$whitelist)) {

and it fails for the fields not in there. So that makes sense. But the
ridiculously frustrating thing is that the fields *are in the
database*. In the table that belongs to the model. Same name, same
capitalizations. I just can't figure out what the problem here is...
does anyone have any idea?

Joe

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---