Re: Empty relation belongsto 1.3

2010-03-25 Thread Jamie
The blank hasOne array (with all of the empty keys) has always struck
me as the most counter-intuitive thing ever. An empty relation should
be completely empty. If this is now the case with belongsTo (I haven't
tested), then that seems to be a step backwards.


On Mar 24, 4:19 pm, RobertMeisner rob...@catchit.pl wrote:
 has something changed in ver 1.3 coresponding to how empty relations
 are presented?

 Whenever i use 0 or null as foreign-key i get something like (so its
 same as it's always been with hasOne relations):

 [Webpage] = Array
                 (
                     [id] = 1
                     [created] = 2008-04-17 15:06:22
                     [modified] = 2010-03-24 16:43:57
                     [name] = Home Webpage
                    [myforeign_id]=0
 )
 [Myforeign] = Array
                 (
                     [id] =
                     [created] =
                     [modified] =
                     [name] =
 )
 I believe in previous versions array would look more like:
 [Webpage] = Array
                 (
                     [id] = 1
                     [created] = 2008-04-17 15:06:22
                     [modified] = 2010-03-24 16:43:57
                     [name] = Home Webpage
                    [myforeign_id]=0
 )
 [Myforeign] = Array
                 (
 )

 What i believe does make more sense.

 So here comes next question: How should i check if relation is empty?
 empty($arr[Myforeign][id])???

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Empty relation belongsto 1.3

2010-03-25 Thread Jamie
The reason for the empty hasOne relation is because Cake LEFT JOINs
the relation and doesn't check for an empty record before returning
the array. You can specify INNER if you want when declaring the
relationship, but then if the related record is empty nothing will be
returned. I suspect that's why your belongsTo relation is happening in
the same way - a left join. This, I think, is one of those it's a
feature, not a bug situations. ;)


On Mar 25, 11:52 am, Jamie jamie@gmail.com wrote:
 The blank hasOne array (with all of the empty keys) has always struck
 me as the most counter-intuitive thing ever. An empty relation should
 be completely empty. If this is now the case with belongsTo (I haven't
 tested), then that seems to be a step backwards.

 On Mar 24, 4:19 pm, RobertMeisner rob...@catchit.pl wrote:

  has something changed in ver 1.3 coresponding to how empty relations
  are presented?

  Whenever i use 0 or null as foreign-key i get something like (so its
  same as it's always been with hasOne relations):

  [Webpage] = Array
                  (
                      [id] = 1
                      [created] = 2008-04-17 15:06:22
                      [modified] = 2010-03-24 16:43:57
                      [name] = Home Webpage
                     [myforeign_id]=0
  )
  [Myforeign] = Array
                  (
                      [id] =
                      [created] =
                      [modified] =
                      [name] =
  )
  I believe in previous versions array would look more like:
  [Webpage] = Array
                  (
                      [id] = 1
                      [created] = 2008-04-17 15:06:22
                      [modified] = 2010-03-24 16:43:57
                      [name] = Home Webpage
                     [myforeign_id]=0
  )
  [Myforeign] = Array
                  (
  )

  What i believe does make more sense.

  So here comes next question: How should i check if relation is empty?
  empty($arr[Myforeign][id])???



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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Empty relation belongsto 1.3

2010-03-25 Thread RobertMeisner
its not intuitive at all.
And now i need to do major rewrite of the app... i hoped some1 would
tell its only RC2 feature and in live it s going to be as it should
be...

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Empty relation belongsto 1.3

2010-03-24 Thread RobertMeisner
has something changed in ver 1.3 coresponding to how empty relations
are presented?

Whenever i use 0 or null as foreign-key i get something like (so its
same as it's always been with hasOne relations):

[Webpage] = Array
(
[id] = 1
[created] = 2008-04-17 15:06:22
[modified] = 2010-03-24 16:43:57
[name] = Home Webpage
   [myforeign_id]=0
)
[Myforeign] = Array
(
[id] =
[created] =
[modified] =
[name] =
)
I believe in previous versions array would look more like:
[Webpage] = Array
(
[id] = 1
[created] = 2008-04-17 15:06:22
[modified] = 2010-03-24 16:43:57
[name] = Home Webpage
   [myforeign_id]=0
)
[Myforeign] = Array
(
)

What i believe does make more sense.

So here comes next question: How should i check if relation is empty?
empty($arr[Myforeign][id])???

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.