Re: SaveAll fails when adding multiple checks to single model field

2014-07-15 Thread Lorenzo Milesi
> saveAll fails with the following error:
> Warning (2): Illegal string offset 'user_id' [CORE/Cake/Model/Model.php, line
> 2094]

an update on this issue which is driving me mad. I returned to a working state 
using 2.0.6, and I just found out that whatever code I add to the model or to 
the controller raises the error. And this is completely WEIRD! Since I couldn't 
add the validator to the model I added a check to the controller. This is the 
patch:
diff --git a/app/Controller/UsersController.php 
b/app/Controller/UsersController.php
index 18b040d..08b87d6 100644
--- a/app/Controller/UsersController.php
+++ b/app/Controller/UsersController.php
@@ -449,6 +449,11 @@ public function login(){
 $this->Session->setFlash($msg, 'flash_message');
 
if ($this->request->is('post')){
+if ($this->User->find('count', 
array('conditions'=>array('email'=>$this->request->data['User']['email']))) > 
0) {
+$this->Session->setFlash(__('Your email address is 
already registered, please try the password recovery tool'), 'flas
+$this->redirect("/users/login");
+}
+

With *just this* code added the saveAll fails! How is this possible???
I tried deleting everything in tmp/cache/*/cake* but no change.
I am for sure missing something here. Is there any action I should do from Cake 
console to clear some other cache I don't know?

Thanks
-- 
Lorenzo Milesi - lorenzo.mil...@yetopen.it

YetOpen S.r.l. - http://www.yetopen.it/

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: 3.x - SecurityComponent and View Cell

2014-07-15 Thread Thomas von Hassel
It's a block of custom fields and all that logic is shared between several 
models and views


/thomas

On 16 Jul 2014, at 03:33, mark_story  wrote:

> Why is only part of the form in a cell?
> 
> -mark
> 
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Recurring Period

2014-07-15 Thread Frank Hassani
Dear Tarique,
thank you for your reply. Besides that the cron-jobs feature is great for 
db backup for me and i have this task on my list as well, i am looking to 
enter multiple entries at the same time. In such terms that in the 
bookkeeping app i'm developing on with a programmer collegue (i'm not a 
good enough programmer), i want to pre-research for the coder to setup for 
example to enter "receivables" that have to be paid in the future, into a 
payables calendar, so that they already exist there way in the future, and 
i can track my future account balance, when i, in the same manner, enter 
expected income. 
I was wondering if there already exists a snippet or plugin that has this 
kind of functionality achieved and we can build upon for our needs, so 
don't have to re-invent the wheel where there possibly is proven code 
existing for us.
If you have a tip in this direction would be greatly appreciated :)

Best regards,
Frank
 

On Wednesday, July 16, 2014 7:09:55 AM UTC+2, Dr. Tarique Sani wrote:
>
> Start here 
> http://book.cakephp.org/2.0/en/console-and-shells/cron-jobs.html 
>
> T
>
>
> On Tue, Jul 15, 2014 at 9:23 AM, Frank Hassani  > wrote:
>
>> Hi,
>> I want to create recurring entries in my app. I was wondering if someone 
>> knows about a snippet for the interface that i could use ? Google didn't 
>> find one.
>>
>> Like here:
>>
>> 
>>
>> Regards,
>>
>> Frank
>>
>>  -- 
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to cake-php+u...@googlegroups.com .
>> To post to this group, send email to cake...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/cake-php.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> =
> The Conference Schedule Creator : http://shdlr.com
>
> PHP for E-Biz : http://sanisoft.com
> = 
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Recurring Period

2014-07-15 Thread Dr. Tarique Sani
Start here http://book.cakephp.org/2.0/en/console-and-shells/cron-jobs.html

T


On Tue, Jul 15, 2014 at 9:23 AM, Frank Hassani  wrote:

> Hi,
> I want to create recurring entries in my app. I was wondering if someone
> knows about a snippet for the interface that i could use ? Google didn't
> find one.
>
> Like here:
>
> 
>
> Regards,
>
> Frank
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
=
The Conference Schedule Creator : http://shdlr.com

PHP for E-Biz : http://sanisoft.com
=

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: CakePHP for beginner

2014-07-15 Thread Dr. Tarique Sani
Which books have you read?

Have you tried the tutorial at
http://book.cakephp.org/2.0/en/tutorials-and-examples.html ?

T


On Tue, Jul 15, 2014 at 11:22 PM, sajju  wrote:

> I'm sorry if I'm posting this in a wrong place. The thing is, I'm a
> beginner to CakePHP and wanna learn more. Read CakeBooks but no where near
> to develop an application from scratch. Please suggest me some learning
> material (books, website) or fully developed applications. Please reply.
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
=
The Conference Schedule Creator : http://shdlr.com

PHP for E-Biz : http://sanisoft.com
=

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


3.x - SecurityComponent and View Cell

2014-07-15 Thread mark_story
Why is only part of the form in a cell?

-mark

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Bolo de 2.4 e muito mais esquemas no db postgresql?

2014-07-15 Thread André Krebs
Guys, I organized a little my postgresql database using schemas, however, 
can not configure Cakephp 2.4 to list the database tables that are outside 
the schema's time I give the command cake bake> m list (model). 

 

Someone here knows how to solve this? 

 

Thank you!

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


CakePHP for beginner

2014-07-15 Thread sajju
I'm sorry if I'm posting this in a wrong place. The thing is, I'm a 
beginner to CakePHP and wanna learn more. Read CakeBooks but no where near 
to develop an application from scratch. Please suggest me some learning 
material (books, website) or fully developed applications. Please reply.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: 3.x - date time fields

2014-07-15 Thread José Lorenzo
Do you have a suggestion of how it could be made easier?

On Tuesday, July 15, 2014 8:58:56 PM UTC+2, Thomas von Hassel wrote:
>
> yes, but turns out our local way of writing dates is backwards in both 
> order and separators so DateTime gets confused ..
>
> /thomas
>
>
> On 15 Jul 2014, at 17:35, José Lorenzo  wrote:
>
> If you send a string that can be parsed by DateTime() it should just work
>
> On Tuesday, July 15, 2014 3:43:23 PM UTC+2, Thomas von Hassel wrote:
>>
>> Hi 
>>
>> Ok, date time fields in 3.x are kicking my ass a bit, because i don’t 
>> want to use the builtin dateTime widget, but just a text field with a 
>> javascript date picker. 
>>
>> Now, when the post data is marshalled, is there a good place to configure 
>> how a date/time string is parsed to the DateTime object ? 
>>
>> I spent a lot of time trying to use Entity get/set to transform my data, 
>> but i’m going to have a lot of models where is needs to be done, so i’ve 
>> tried to use Traits on the entity, but couldn’t find a good place to 
>> override setting of arbitrary properties. 
>>
>> Any other good ideas ? 
>>
>> /thomas 
>>
>>
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: 3.x - date time fields

2014-07-15 Thread Thomas von Hassel
yes, but turns out our local way of writing dates is backwards in both order 
and separators so DateTime gets confused ..

/thomas


On 15 Jul 2014, at 17:35, José Lorenzo  wrote:

> If you send a string that can be parsed by DateTime() it should just work
> 
> On Tuesday, July 15, 2014 3:43:23 PM UTC+2, Thomas von Hassel wrote:
> Hi 
> 
> Ok, date time fields in 3.x are kicking my ass a bit, because i don't want to 
> use the builtin dateTime widget, but just a text field with a javascript date 
> picker. 
> 
> Now, when the post data is marshalled, is there a good place to configure how 
> a date/time string is parsed to the DateTime object ? 
> 
> I spent a lot of time trying to use Entity get/set to transform my data, but 
> i'm going to have a lot of models where is needs to be done, so i've tried to 
> use Traits on the entity, but couldn't find a good place to override setting 
> of arbitrary properties. 
> 
> Any other good ideas ? 
> 
> /thomas 
> 
> 
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


403 error

2014-07-15 Thread Jeremy Burns
I have a site that works fine most of the time, but on occasion I'll get 
403 errors for a page even if I have previously viewed it successfully, 
sometimes when I refresh a page. Sometimes clearing the cache resolves the 
issue but on others I need to restart the browser. Any clues what's 
happening?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: 3.x - date time fields

2014-07-15 Thread José Lorenzo
If you send a string that can be parsed by DateTime() it should just work

On Tuesday, July 15, 2014 3:43:23 PM UTC+2, Thomas von Hassel wrote:
>
> Hi 
>
> Ok, date time fields in 3.x are kicking my ass a bit, because i don’t want 
> to use the builtin dateTime widget, but just a text field with a javascript 
> date picker. 
>
> Now, when the post data is marshalled, is there a good place to configure 
> how a date/time string is parsed to the DateTime object ? 
>
> I spent a lot of time trying to use Entity get/set to transform my data, 
> but i’m going to have a lot of models where is needs to be done, so i’ve 
> tried to use Traits on the entity, but couldn’t find a good place to 
> override setting of arbitrary properties. 
>
> Any other good ideas ? 
>
> /thomas 
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Data Validation: Checking if at least one field is populated and multiple rules not validating

2014-07-15 Thread Stephen S
You can try dynamically adding or removing validation rules in your custom
'checkOne' method.

http://book.cakephp.org/2.0/en/models/data-validation.html#removing-rules-from-the-set


On 15 July 2014 15:44, seba  wrote:

> Folks,
>
> I'm trying to ensure at least one of two fields (last_name or email) is
> being populated. Each field also has multiple rules. I'm using CakePHP
> version 2.4.2.
>
> The problem I have at the moment, after multiple permutations of updating
> and/or moving around the use 'last', 'allowEmpty', 'required', etc, is that
> the fields just aren't validating at all, or aren't executing all the rules
> when a field is populated.
>
> Any advice on how to modify the code below to achieve the following
> behaviour is much appreciated:
> 1. One of the two fields must be populated;
> 2. The other rules attached to each field must validate as well (i.e. if a
> last name is passed, then it must be between 2 and 45 chars and
> alphanumeric only)
>
> Here's the model code:
>
> public $validate = array(
> 'last_name'=> array(
> 'needOne' => array (
> 'required' => FALSE,
> 'allowEmpty' => TRUE,
> 'last' => TRUE,
> 'rule' => array('checkOne','last_name'),
> 'message' => 'You must enter at least a contact name or email address.'
>  ),
> 'alphaNumeric' => array(
> 'rule' => 'alphaNumeric',
> 'message'  => 'Alphabets and numbers only'
> ),
> 'between' => array(
> 'rule' => array('between', 2, 45),
> 'message' => 'Between 2 to 45 characters'
> )
> ),
> 'email' => array(
> 'needOne' => array (
> 'required' => FALSE,
> 'allowEmpty' => TRUE,
> 'last' => TRUE,
> 'rule' => array('checkOne','email'),
> 'message' => 'You must enter at least a contact name or email address.'
>  ),
> 'emailAddress' => array (
> 'last' => TRUE,
> 'rule' => array('email', FALSE),
> 'message'  => 'A valid Email address is required'
>  )
> )
> );
>  // Ensure at least the last name or email field value is provided
> function checkOne() {
> if(!empty($this->data[$this->User]['last_name']) ||
> !empty($this->data[$this->User]['email'])){
> return true;
> } else {
> return false;
> }
> }
>
> Thanks in advance!
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Kind Regards
 Stephen Speakman

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Data Validation: Checking if at least one field is populated and multiple rules not validating

2014-07-15 Thread seba
Folks,

I'm trying to ensure at least one of two fields (last_name or email) is 
being populated. Each field also has multiple rules. I'm using CakePHP 
version 2.4.2. 

The problem I have at the moment, after multiple permutations of updating 
and/or moving around the use 'last', 'allowEmpty', 'required', etc, is that 
the fields just aren't validating at all, or aren't executing all the rules 
when a field is populated.

Any advice on how to modify the code below to achieve the following 
behaviour is much appreciated:
1. One of the two fields must be populated;
2. The other rules attached to each field must validate as well (i.e. if a 
last name is passed, then it must be between 2 and 45 chars and 
alphanumeric only)

Here's the model code:

public $validate = array(
'last_name'=> array(
'needOne' => array (
'required' => FALSE,
'allowEmpty' => TRUE,
'last' => TRUE,
'rule' => array('checkOne','last_name'),
'message' => 'You must enter at least a contact name or email address.'
 ),
'alphaNumeric' => array(
'rule' => 'alphaNumeric',
'message'  => 'Alphabets and numbers only'
),
'between' => array(
'rule' => array('between', 2, 45),
'message' => 'Between 2 to 45 characters'
)
),
'email' => array(
'needOne' => array (
'required' => FALSE,
'allowEmpty' => TRUE,
'last' => TRUE,
'rule' => array('checkOne','email'),
'message' => 'You must enter at least a contact name or email address.'
 ),
'emailAddress' => array (
'last' => TRUE,
'rule' => array('email', FALSE),
'message'  => 'A valid Email address is required'
 )
)
);
 // Ensure at least the last name or email field value is provided
function checkOne() {
if(!empty($this->data[$this->User]['last_name']) || 
!empty($this->data[$this->User]['email'])){
return true;
} else {
return false;
}
}

Thanks in advance!

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


3.x - date time fields

2014-07-15 Thread Thomas von Hassel
Hi

Ok, date time fields in 3.x are kicking my ass a bit, because i don't want to 
use the builtin dateTime widget, but just a text field with a javascript date 
picker.

Now, when the post data is marshalled, is there a good place to configure how a 
date/time string is parsed to the DateTime object ?

I spent a lot of time trying to use Entity get/set to transform my data, but 
i'm going to have a lot of models where is needs to be done, so i've tried to 
use Traits on the entity, but couldn't find a good place to override setting of 
arbitrary properties.

Any other good ideas ?

/thomas

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: SaveAll fails when adding multiple checks to single model field

2014-07-15 Thread Lorenzo Milesi
> From what I read you just had to deactive the html5 frontend validation.
> matter of seconds.

Not even that. :( I still get corrupted html and empty validation results.


-- 
Lorenzo Milesi - lorenzo.mil...@yetopen.it

YetOpen S.r.l. - http://www.yetopen.it/

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: SaveAll fails when adding multiple checks to single model field

2014-07-15 Thread euromark
>From what I read you just had to deactive the html5 frontend validation. 
matter of seconds.
But did it work for you with saveAll() then?

PS:
If you need to stay in 2.0:
Try to debug() your way into the core until you find out more about the 
issue


Am Dienstag, 15. Juli 2014 14:32:24 UTC+2 schrieb Lorenzo Milesi:
>
> > It might be worth upgrading to the latest master = 2.5 
> > Its kinda nonsense to stick to 2.0 when there might be a great chance 
> that 
> > this is fixed in the core in a current version 
> > especially since upgrading inside 2.x is a few minutes total. 
>
> I agree with you, but sadly I cannot agree on the upgrade timing. I had to 
> revert back from 2.5 to 2.0 because of many issues in forms (see my post of 
> few hours ago). Almost everything is fine in 2.5 but the user registration 
> page broke, so I cannot keep it so far. I need to stick to 2.0 as long as I 
> cannot figure out other errors. 
> In the meantime I need to understand why it fails with multiple checks. 
> thanks 
> -- 
> Lorenzo Milesi - lorenzo...@yetopen.it  
>
> YetOpen S.r.l. - http://www.yetopen.it/ 
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: SaveAll fails when adding multiple checks to single model field

2014-07-15 Thread Lorenzo Milesi
> It might be worth upgrading to the latest master = 2.5
> Its kinda nonsense to stick to 2.0 when there might be a great chance that
> this is fixed in the core in a current version
> especially since upgrading inside 2.x is a few minutes total.

I agree with you, but sadly I cannot agree on the upgrade timing. I had to 
revert back from 2.5 to 2.0 because of many issues in forms (see my post of few 
hours ago). Almost everything is fine in 2.5 but the user registration page 
broke, so I cannot keep it so far. I need to stick to 2.0 as long as I cannot 
figure out other errors.
In the meantime I need to understand why it fails with multiple checks.
thanks
-- 
Lorenzo Milesi - lorenzo.mil...@yetopen.it

YetOpen S.r.l. - http://www.yetopen.it/

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: SaveAll fails when adding multiple checks to single model field

2014-07-15 Thread euromark
It might be worth upgrading to the latest master = 2.5
Its kinda nonsense to stick to 2.0 when there might be a great chance that 
this is fixed in the core in a current version
especially since upgrading inside 2.x is a few minutes total.
And I have seen dozens of cases where this actually did the trick - and 
people spent hours debugging where there would never have been the reason 
to do it in the first place... ;)

this also goes for all future issues you will encounter.
mark


Am Dienstag, 15. Juli 2014 14:24:01 UTC+2 schrieb Lorenzo Milesi:
>
> I have a model with an email field, the validator definition of the field 
> is this: 
> 'email' => array( 
> 'email' => array( 
> 'rule' => 'email', 
> 'message' => 'Please specify a valid email 
> address', 
> ), 
> ), 
>
> and it works. As soon as I add an isUnique validator to the same field: 
> 'email' => array( 
> 'email' => array( 
> 'rule' => 'email', 
> 'message' => 'Please specify a valid email 
> address', 
> ), 
> 'unique' => array( 
> 'rule' => 'isUnique', 
> 'message' => 'This email address has 
> already been registered', 
> ), 
> ), 
>
> saveAll fails with the following error: 
> Warning (2): Illegal string offset 'user_id' [CORE/Cake/Model/Model.php, 
> line 2094] 
> I'm getting mad about this! I'm using Cake 2.0.6. 
>
> thanks 
> -- 
> Lorenzo Milesi - lorenzo...@yetopen.it  
>
> YetOpen S.r.l. - http://www.yetopen.it/ 
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


SaveAll fails when adding multiple checks to single model field

2014-07-15 Thread Lorenzo Milesi
I have a model with an email field, the validator definition of the field is 
this:
'email' => array(
'email' => array(
'rule' => 'email',
'message' => 'Please specify a valid email 
address',
),
),

and it works. As soon as I add an isUnique validator to the same field:
'email' => array(
'email' => array(
'rule' => 'email',
'message' => 'Please specify a valid email 
address',
),
'unique' => array(
'rule' => 'isUnique',
'message' => 'This email address has already 
been registered',
),
),

saveAll fails with the following error:
Warning (2): Illegal string offset 'user_id' [CORE/Cake/Model/Model.php, line 
2094]
I'm getting mad about this! I'm using Cake 2.0.6.

thanks
-- 
Lorenzo Milesi - lorenzo.mil...@yetopen.it

YetOpen S.r.l. - http://www.yetopen.it/

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrade 2.0.x->2.5.x: problem in generated HTML in case of erros

2014-07-15 Thread John Sposato
You are probably running into the HTML5 validation that was added in 2.3:


   - The FormHelper now also adds the HTML5 required attribute to your 
   input elements based on validation rules for a field. If you have a 
   “Cancel” button in your form which submits the form then you should add
   'formnovalidate' => true to your button options to prevent the 
   triggering of validation in HTML. You can also prevent the validation 
   triggering for the whole form by adding 'novalidate' => true in your 
   FormHelper::create() options.

See this link for more information on changes in the FormHelper:

http://book.cakephp.org/2.0/en/appendices/2-3-migration-guide.html#formhelper


On Tuesday, July 15, 2014 3:49:37 AM UTC-4, Lorenzo Milesi wrote:
>
> Hi. 
> I did a massive upgrade from 2.0 series to 2.5, now I'm stuck with some 
> errors in a form. I have two issues: 1. for some fields, which should not 
> be compulsory, I get empty errors. 2. when I have errors the HTML structure 
> gets corrupted and the page view is broken. 
> I'm new to Cake, I've taken over this project and I'm starting to use it. 
> I'm experienced in PHP and other frameworks, tough. 
>
> This is the UserDetail module validation: 
> public $validate = array( 
> 'user_id' => array( 
> 'numeric' => array( 
> 'rule' => array('numeric'), 
> ), 
> ), 
> 'sex_id' => array( 
> 'numeric' => array( 
> 'rule' => array('numeric'), 
> 'message' => 'Please specify your sex', 
> ), 
> ), 
> 'birth' => array( 
> 'date' => array( 
> 'rule' => array('date'), 
> 'message' => 'Please select your date of 
> birth', 
> ), 
> ), 
> /*'organization' => array( 
> 'notempty' => array( 
> 'rule' => array('notempty'), 
> 'message' => 'Please specify your 
> organization name', 
> ), 
> ),*/ 
> 'country_id' => array( 
> 'numeric' => array( 
> 'rule' => array('numeric'), 
> 'message' => 'Please select your country', 
> ), 
> ), 
> 'state_province' => array( 
> 'notempty' => array( 
> 'rule' => array('notempty'), 
> 'message' => 'Please select your 
> province', 
> ), 
> ), 
> 'city' => array( 
> 'notempty' => array( 
> 'rule' => array('notempty'), 
> 'message' => 'Please complete the city 
> field', 
> ), 
> ), 
> 'url' => array( 
> 'url' => array( 
> 'rule' => array('url'), 
> 'message' => 'Please specify a correct 
> URL', 
> 'allowEmpty' => true, 
> 'required' => false, 
> ), 
> ), 
> 'bio' => array( 
> 'notempty' => array( 
> 'rule' => array('notempty'), 
> 'message' => 'Please provide some 
> information about you', 
> 'allowEmpty' => true, 
> ), 
> ), 
> 'secret' => array( 
> 'notempty' => array( 
> 'rule' => array('notempty'), 
> 'message' => 'Please create a secret 
> question', 
> ), 
> ), 
> 'secret_answer' => array( 
> 'notempty' => array( 
> 'rule' => array('notempty'), 
> 'message' => 'Please supply an answer to 
> the above question', 
> ), 
> ), 
> 'discoverable' => array( 
> 'boolean' => array( 
> 'rule' => array('boolean'), 
> ), 
> ), 
> ); 
>
> This is the user add template: 
>  
>   
>
> Form->create('User', array('type' => 'file', 'url' 
> => array('controller' => 'users', 'action' => 'add'), 'class' => 
> 'WfGenericForm')); ?> 
>
>  
>
>  .$this->Html->link(__('(Knowledge Base)'), 

Re: 3.x - Entity Accessors & Mutators

2014-07-15 Thread Thomas von Hassel
I got to work by checking if the property was dirty or not and only setting it 
when it's clean

/Thomas




Sent from my iPhone

> On 15/07/2014, at 11.56, José Lorenzo  wrote:
> 
> Not right now, but it definitely makes sense. I will propose the change today 
> in a ticket as I think that using data from the getters in entities for 
> saving was a bad idea after all.
> 
>> On Tuesday, July 15, 2014 11:13:28 AM UTC+2, Thomas von Hassel wrote:
>> Hey (again ..) 
>> 
>> Is it correct that it is not possible to do _getXx and _setXx for the same 
>> field and have it translate to and from the data saved in the database. (say 
>> save the date in mysql format in the table, but present it localised ?) 
>> 
>> 
>> /thomas
> 
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: 3.x - Entity Accessors & Mutators

2014-07-15 Thread José Lorenzo
Not right now, but it definitely makes sense. I will propose the change 
today in a ticket as I think that using data from the getters in entities 
for saving was a bad idea after all.

On Tuesday, July 15, 2014 11:13:28 AM UTC+2, Thomas von Hassel wrote:
>
> Hey (again ..) 
>
> Is it correct that it is not possible to do _getXx and _setXx for the same 
> field and have it translate to and from the data saved in the database. 
> (say save the date in mysql format in the table, but present it localised 
> ?) 
>
>
> /thomas 
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


3.x - Entity Accessors & Mutators

2014-07-15 Thread Thomas von Hassel
Hey (again ..)

Is it correct that it is not possible to do _getXx and _setXx for the same 
field and have it translate to and from the data saved in the database. (say 
save the date in mysql format in the table, but present it localised ?)


/thomas

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Upgrade 2.0.x->2.5.x: problem in generated HTML in case of erros

2014-07-15 Thread Lorenzo Milesi
Hi.
I did a massive upgrade from 2.0 series to 2.5, now I'm stuck with some errors 
in a form. I have two issues: 1. for some fields, which should not be 
compulsory, I get empty errors. 2. when I have errors the HTML structure gets 
corrupted and the page view is broken.
I'm new to Cake, I've taken over this project and I'm starting to use it. I'm 
experienced in PHP and other frameworks, tough.

This is the UserDetail module validation:
public $validate = array(
'user_id' => array(
'numeric' => array(
'rule' => array('numeric'),
),
),
'sex_id' => array(
'numeric' => array(
'rule' => array('numeric'),
'message' => 'Please specify your sex',
),
),
'birth' => array(
'date' => array(
'rule' => array('date'),
'message' => 'Please select your date of birth',
),
),
/*'organization' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Please specify your organization 
name',
),
),*/
'country_id' => array(
'numeric' => array(
'rule' => array('numeric'),
'message' => 'Please select your country',
),
),
'state_province' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Please select your province',
),
),
'city' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Please complete the city field',
),
),
'url' => array(
'url' => array(
'rule' => array('url'),
'message' => 'Please specify a correct URL',
'allowEmpty' => true,
'required' => false,
),
),
'bio' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Please provide some information 
about you',
'allowEmpty' => true,
),
),
'secret' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Please create a secret question',
),
),
'secret_answer' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Please supply an answer to the 
above question',
),
),
'discoverable' => array(
'boolean' => array(
'rule' => array('boolean'),
),
),
);

This is the user add template:

 

Form->create('User', array('type' => 'file', 'url' => 
array('controller' => 'users', 'action' => 'add'), 'class' => 
'WfGenericForm')); ?>



Html->link(__('(Knowledge Base)'), array('controller' => 'pages', 
'action' => 'view','knowledge-base'), array('style' => 'font-size:12px;', 
'target' => '_blank')); */ ?>
Form->inputs(array(
'legend' => false,
'fieldset' => false,
'name' => array('label' => $this->element('form_tooltip', 
array('code' => 'register_name')) . __('Name')),
'surname' => array('label' => $this->element('form_tooltip', 
array('code' => 'register_surname')) . __('Surname')),
'email' => array('label' => $this->element('form_tooltip', 
array('code' => 'register_email')) . __('Email')),
'UserDetail.organization' => array('label' => 
$this->element('form_tooltip', array('code' => 'register_organization')) . 
__('Organization')),
'user_types_id' => array('label' => 'User Type', 'type' => 
'select', 'options' => $userTypes),
//'username',
'password',
'confirm_password' => array('type' => 'password', 'label' => 
__('Confirm Password')),
'UserDetail.url' => array('label