Re: hasMany weirdness

2013-09-15 Thread John Andersen
Just in case that you are using an existing database, in which you cannot 
change the primary key. 
Read about Primary key in the CakePHP documentation at this link:
http://book.cakephp.org/2.0/en/models/model-attributes.html

Enjoy, John

Ps. make a test environment, so you can test before putting it into 
production.

On Saturday, 14 September 2013 03:29:40 UTC+3, Eric Haskins wrote:

 Ok Ill have to wait code is in production right now. 

 [snip] 

-- 
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/groups/opt_out.


Re: hasMany weirdness

2013-09-15 Thread Eric Haskins
Yeah I have the primaryKey Set on all the models that don't use just id 
 that's why I posted it here to see if anyone else had seen this behavior. 
 Its weird because its consistently the same records that will show blank 
players arrays or Team arrays.   So I just started writing custom queries 
with joins using $this-PlayersToSeasons-query() and the problem is gone. 
I know that will send some Framework nazi's into committing suicide but you 
do what you have to to make your app work. Till I can sort out why cake is 
hanging me out to dry lol

Eric Haskins
High Octane Brands LLC


-- 
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/groups/opt_out.


Re: hasMany weirdness

2013-09-13 Thread John Andersen
Please ensure that the Players, Seasons and Divisions tables primary key is 
ID and not like tablename_id.
When done, try again :)
Enjoy, John

On Friday, 13 September 2013 01:58:43 UTC+3, Eric Haskins wrote:

 Has anyone else seen where hasMany returns empty arrays's?  Example 

 Players
 player_id

 Seasons
 season_id

 Divisions
 division_id

 PlayersToSeasons  - hasMany Players, Seasons, Divisions,
 id
 season_id
 player_id
 division_id


 So many will come back perfect out of 300 players maybe 20 records will be

 Array(

  [200] = array(
[PlayersToSeasons] = array(
id = 3
season_id = 3
.   
),
[Players] = array(
),
[Divisions] = array(
)
 )
 )

 So the parent where the find is called is perfect but the Players array 
 will be blank or the Divisions array will be blank.

 I was forced to write individual queries for all the records I needed.  I 
 checked all the foreignkeys were the same type and everything


  


-- 
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/groups/opt_out.


Re: hasMany weirdness

2013-09-13 Thread Eric Haskins
Ok Ill have to wait code is in production right now. 

On Friday, September 13, 2013 2:40:16 PM UTC-4, John Andersen wrote:

 Please ensure that the Players, Seasons and Divisions tables primary key 
 is ID and not like tablename_id.
 When done, try again :)
 Enjoy, John

 On Friday, 13 September 2013 01:58:43 UTC+3, Eric Haskins wrote:

 Has anyone else seen where hasMany returns empty arrays's?  Example 

 Players
 player_id

 Seasons
 season_id

 Divisions
 division_id

 PlayersToSeasons  - hasMany Players, Seasons, Divisions,
 id
 season_id
 player_id
 division_id


 So many will come back perfect out of 300 players maybe 20 records will be

 Array(

  [200] = array(
[PlayersToSeasons] = array(
id = 3
season_id = 3
.   
),
[Players] = array(
),
[Divisions] = array(
)
 )
 )

 So the parent where the find is called is perfect but the Players array 
 will be blank or the Divisions array will be blank.

 I was forced to write individual queries for all the records I needed.  I 
 checked all the foreignkeys were the same type and everything


  



-- 
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/groups/opt_out.


hasMany weirdness

2013-09-12 Thread Eric Haskins
Has anyone else seen where hasMany returns empty arrays's?  Example 

Players
player_id

Seasons
season_id

Divisions
division_id

PlayersToSeasons  - hasMany Players, Seasons, Divisions,
id
season_id
player_id
division_id


So many will come back perfect out of 300 players maybe 20 records will be

Array(

 [200] = array(
   [PlayersToSeasons] = array(
   id = 3
   season_id = 3
   .   
   ),
   [Players] = array(
   ),
   [Divisions] = array(
   )
)
)

So the parent where the find is called is perfect but the Players array 
will be blank or the Divisions array will be blank.

I was forced to write individual queries for all the records I needed.  I 
checked all the foreignkeys were the same type and everything


 

-- 
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/groups/opt_out.