controller validation methods seem to have no effect.

2010-06-21 Thread Josey
Greetings,

I am attempting to validate data before a save in the controller

$this-data['Order']['orderid'] = 'ecommerceorderid#'

$this-Order-set($this-data);

$this-Order-validates();

-

I manually set $this-data['Order']['orderid'] to a value that is
already present in the database and my model validation rules state
that 'orderid' is set to 'isUnique'.

When I print $this-Order-validates();, however, the method returns a
value of '1', which it should not due to the fact that the value is
already in the database.

Am I missing something?

Basically my application pulls a list of orders from an exterior
applications API based on a date range. Sometimes some of the items
within that range may have been pulled at the end of a previous
request so I want to exclude those from the save array BEFORE the save
takes place so that all valid entries are logged and invalid ones are
skipped altogether.

Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: controller validation methods seem to have no effect.

2010-06-21 Thread Jeremy Burns | Class Outfit
If you set the value of id in your data array Cake assumes you are doing an 
update rather than an insert, so it might well be true that it validates. 
Sounds like you need to pull a set of ids from the database and remove them 
from the data array before attempting your save.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 21 Jun 2010, at 17:13, Josey wrote:

 Greetings,
 
 I am attempting to validate data before a save in the controller
 
 $this-data['Order']['orderid'] = 'ecommerceorderid#'
 
 $this-Order-set($this-data);
 
 $this-Order-validates();
 
 -
 
 I manually set $this-data['Order']['orderid'] to a value that is
 already present in the database and my model validation rules state
 that 'orderid' is set to 'isUnique'.
 
 When I print $this-Order-validates();, however, the method returns a
 value of '1', which it should not due to the fact that the value is
 already in the database.
 
 Am I missing something?
 
 Basically my application pulls a list of orders from an exterior
 applications API based on a date range. Sometimes some of the items
 within that range may have been pulled at the end of a previous
 request so I want to exclude those from the save array BEFORE the save
 takes place so that all valid entries are logged and invalid ones are
 skipped altogether.
 
 Thanks!
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: controller validation methods seem to have no effect.

2010-06-21 Thread euromark
can you post your validation rules here?


On 21 Jun., 18:13, Josey josey.mor...@gmail.com wrote:
 Greetings,

 I am attempting to validate data before a save in the controller

 $this-data['Order']['orderid'] = 'ecommerceorderid#'

 $this-Order-set($this-data);

 $this-Order-validates();

 -

 I manually set $this-data['Order']['orderid'] to a value that is
 already present in the database and my model validation rules state
 that 'orderid' is set to 'isUnique'.

 When I print $this-Order-validates();, however, the method returns a
 value of '1', which it should not due to the fact that the value is
 already in the database.

 Am I missing something?

 Basically my application pulls a list of orders from an exterior
 applications API based on a date range. Sometimes some of the items
 within that range may have been pulled at the end of a previous
 request so I want to exclude those from the save array BEFORE the save
 takes place so that all valid entries are logged and invalid ones are
 skipped altogether.

 Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: controller validation methods seem to have no effect.

2010-06-21 Thread Josey
It is not the id field of the table, its another field called orderid.

I kindof though I would have to do a find as well just wanted to avoid
as its just that many extra calls to the database.

On Jun 21, 11:18 am, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
 If you set the value of id in your data array Cake assumes you are doing an 
 update rather than an insert, so it might well be true that it validates. 
 Sounds like you need to pull a set of ids from the database and remove them 
 from the data array before attempting your save.

 Jeremy Burns
 Class Outfit

 jeremybu...@classoutfit.comhttp://www.classoutfit.com

 On 21 Jun 2010, at 17:13, Josey wrote:

  Greetings,

  I am attempting to validate data before a save in the controller

  $this-data['Order']['orderid'] = 'ecommerceorderid#'

  $this-Order-set($this-data);

  $this-Order-validates();

  -

  I manually set $this-data['Order']['orderid'] to a value that is
  already present in the database and my model validation rules state
  that 'orderid' is set to 'isUnique'.

  When I print $this-Order-validates();, however, the method returns a
  value of '1', which it should not due to the fact that the value is
  already in the database.

  Am I missing something?

  Basically my application pulls a list of orders from an exterior
  applications API based on a date range. Sometimes some of the items
  within that range may have been pulled at the end of a previous
  request so I want to exclude those from the save array BEFORE the save
  takes place so that all valid entries are logged and invalid ones are
  skipped altogether.

  Thanks!

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
  with their CakePHP related questions.

  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
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: controller validation methods seem to have no effect.

2010-06-21 Thread Josey
Absolutely,

The model validation variable is as follows:

var $validate = array(
'orderid' = 'isUnique'
);

On Jun 21, 11:19 am, euromark dereurom...@googlemail.com wrote:
 can you post your validation rules here?

 On 21 Jun., 18:13, Josey josey.mor...@gmail.com wrote:

  Greetings,

  I am attempting to validate data before a save in the controller

  $this-data['Order']['orderid'] = 'ecommerceorderid#'

  $this-Order-set($this-data);

  $this-Order-validates();

  -

  I manually set $this-data['Order']['orderid'] to a value that is
  already present in the database and my model validation rules state
  that 'orderid' is set to 'isUnique'.

  When I print $this-Order-validates();, however, the method returns a
  value of '1', which it should not due to the fact that the value is
  already in the database.

  Am I missing something?

  Basically my application pulls a list of orders from an exterior
  applications API based on a date range. Sometimes some of the items
  within that range may have been pulled at the end of a previous
  request so I want to exclude those from the save array BEFORE the save
  takes place so that all valid entries are logged and invalid ones are
  skipped altogether.

  Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: controller validation methods seem to have no effect.

2010-06-21 Thread euromark
thats not how a valid cake1.3 validation structure should look like
see the manual:
http://book.cakephp.org/view/125/Data-Validation


On 21 Jun., 19:12, Josey josey.mor...@gmail.com wrote:
 Absolutely,

 The model validation variable is as follows:

         var $validate = array(
                 'orderid' = 'isUnique'
         );

 On Jun 21, 11:19 am, euromark dereurom...@googlemail.com wrote:



  can you post your validation rules here?

  On 21 Jun., 18:13, Josey josey.mor...@gmail.com wrote:

   Greetings,

   I am attempting to validate data before a save in the controller

   $this-data['Order']['orderid'] = 'ecommerceorderid#'

   $this-Order-set($this-data);

   $this-Order-validates();

   -

   I manually set $this-data['Order']['orderid'] to a value that is
   already present in the database and my model validation rules state
   that 'orderid' is set to 'isUnique'.

   When I print $this-Order-validates();, however, the method returns a
   value of '1', which it should not due to the fact that the value is
   already in the database.

   Am I missing something?

   Basically my application pulls a list of orders from an exterior
   applications API based on a date range. Sometimes some of the items
   within that range may have been pulled at the end of a previous
   request so I want to exclude those from the save array BEFORE the save
   takes place so that all valid entries are logged and invalid ones are
   skipped altogether.

   Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: controller validation methods seem to have no effect.

2010-06-21 Thread Josey
I am developing in 1.2.7

On Jun 21, 4:47 pm, euromark dereurom...@googlemail.com wrote:
 thats not how a valid cake1.3 validation structure should look like
 see the manual:http://book.cakephp.org/view/125/Data-Validation

 On 21 Jun., 19:12, Josey josey.mor...@gmail.com wrote:

  Absolutely,

  The model validation variable is as follows:

          var $validate = array(
                  'orderid' = 'isUnique'
          );

  On Jun 21, 11:19 am, euromark dereurom...@googlemail.com wrote:

   can you post your validation rules here?

   On 21 Jun., 18:13, Josey josey.mor...@gmail.com wrote:

Greetings,

I am attempting to validate data before a save in the controller

$this-data['Order']['orderid'] = 'ecommerceorderid#'

$this-Order-set($this-data);

$this-Order-validates();

-

I manually set $this-data['Order']['orderid'] to a value that is
already present in the database and my model validation rules state
that 'orderid' is set to 'isUnique'.

When I print $this-Order-validates();, however, the method returns a
value of '1', which it should not due to the fact that the value is
already in the database.

Am I missing something?

Basically my application pulls a list of orders from an exterior
applications API based on a date range. Sometimes some of the items
within that range may have been pulled at the end of a previous
request so I want to exclude those from the save array BEFORE the save
takes place so that all valid entries are logged and invalid ones are
skipped altogether.

Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: controller validation methods seem to have no effect.

2010-06-21 Thread Josey
Mark,

I changed the formatting of the validation based on the link you
provided and it seems to be working now. Many thanks!

On Jun 21, 4:47 pm, euromark dereurom...@googlemail.com wrote:
 thats not how a valid cake1.3 validation structure should look like
 see the manual:http://book.cakephp.org/view/125/Data-Validation

 On 21 Jun., 19:12, Josey josey.mor...@gmail.com wrote:

  Absolutely,

  The model validation variable is as follows:

          var $validate = array(
                  'orderid' = 'isUnique'
          );

  On Jun 21, 11:19 am, euromark dereurom...@googlemail.com wrote:

   can you post your validation rules here?

   On 21 Jun., 18:13, Josey josey.mor...@gmail.com wrote:

Greetings,

I am attempting to validate data before a save in the controller

$this-data['Order']['orderid'] = 'ecommerceorderid#'

$this-Order-set($this-data);

$this-Order-validates();

-

I manually set $this-data['Order']['orderid'] to a value that is
already present in the database and my model validation rules state
that 'orderid' is set to 'isUnique'.

When I print $this-Order-validates();, however, the method returns a
value of '1', which it should not due to the fact that the value is
already in the database.

Am I missing something?

Basically my application pulls a list of orders from an exterior
applications API based on a date range. Sometimes some of the items
within that range may have been pulled at the end of a previous
request so I want to exclude those from the save array BEFORE the save
takes place so that all valid entries are logged and invalid ones are
skipped altogether.

Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: controller validation methods seem to have no effect.

2010-06-21 Thread Josey
I was wrong, I had an extra rule causing data to get flagged. Once I
removed that all orders go thru, even invalid ones.

var $validate = array(
'orderid' = array(
'isUnique' = array(
'rule' = 'isUnique',
'required' = true,
'message' = 'That order appears to already be in
place.'
)
)
);

On Jun 21, 4:47 pm, euromark dereurom...@googlemail.com wrote:
 thats not how a valid cake1.3 validation structure should look like
 see the manual:http://book.cakephp.org/view/125/Data-Validation

 On 21 Jun., 19:12, Josey josey.mor...@gmail.com wrote:

  Absolutely,

  The model validation variable is as follows:

          var $validate = array(
                  'orderid' = 'isUnique'
          );

  On Jun 21, 11:19 am, euromark dereurom...@googlemail.com wrote:

   can you post your validation rules here?

   On 21 Jun., 18:13, Josey josey.mor...@gmail.com wrote:

Greetings,

I am attempting to validate data before a save in the controller

$this-data['Order']['orderid'] = 'ecommerceorderid#'

$this-Order-set($this-data);

$this-Order-validates();

-

I manually set $this-data['Order']['orderid'] to a value that is
already present in the database and my model validation rules state
that 'orderid' is set to 'isUnique'.

When I print $this-Order-validates();, however, the method returns a
value of '1', which it should not due to the fact that the value is
already in the database.

Am I missing something?

Basically my application pulls a list of orders from an exterior
applications API based on a date range. Sometimes some of the items
within that range may have been pulled at the end of a previous
request so I want to exclude those from the save array BEFORE the save
takes place so that all valid entries are logged and invalid ones are
skipped altogether.

Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: controller validation methods seem to have no effect.

2010-06-21 Thread euromark
that is indeed very strange
the array now looks ok...

On 22 Jun., 00:06, Josey josey.mor...@gmail.com wrote:
 I was wrong, I had an extra rule causing data to get flagged. Once I
 removed that all orders go thru, even invalid ones.

         var $validate = array(
                 'orderid' = array(
             'isUnique' = array(
                 'rule' = 'isUnique',
                 'required' = true,
                 'message' = 'That order appears to already be in
 place.'
                 )
         )
         );

 On Jun 21, 4:47 pm, euromark dereurom...@googlemail.com wrote:



  thats not how a valid cake1.3 validation structure should look like
  see the manual:http://book.cakephp.org/view/125/Data-Validation

  On 21 Jun., 19:12, Josey josey.mor...@gmail.com wrote:

   Absolutely,

   The model validation variable is as follows:

           var $validate = array(
                   'orderid' = 'isUnique'
           );

   On Jun 21, 11:19 am, euromark dereurom...@googlemail.com wrote:

can you post your validation rules here?

On 21 Jun., 18:13, Josey josey.mor...@gmail.com wrote:

 Greetings,

 I am attempting to validate data before a save in the controller

 $this-data['Order']['orderid'] = 'ecommerceorderid#'

 $this-Order-set($this-data);

 $this-Order-validates();

 -

 I manually set $this-data['Order']['orderid'] to a value that is
 already present in the database and my model validation rules state
 that 'orderid' is set to 'isUnique'.

 When I print $this-Order-validates();, however, the method returns a
 value of '1', which it should not due to the fact that the value is
 already in the database.

 Am I missing something?

 Basically my application pulls a list of orders from an exterior
 applications API based on a date range. Sometimes some of the items
 within that range may have been pulled at the end of a previous
 request so I want to exclude those from the save array BEFORE the save
 takes place so that all valid entries are logged and invalid ones are
 skipped altogether.

 Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: controller validation methods seem to have no effect.

2010-06-21 Thread Josey Morton
I will keep tinkering, thank you for your help.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en