execv
execv

Reputation: 849

CakePHP: Model Returning Null Values

I'm having some problems with my associations. I have 3 Models: User, Membership, Company. A user may (or may not) have a company/membership. Here's a pastebin of my models:

http://pastebin.com/xTCQeytn

2 questions I have:

  1. Why is Company/Membership returnning an array full of null values if one does not exist.
  2. Do my associates look correct for what I'm trying to accomplish?

Upvotes: 2

Views: 909

Answers (1)

mark
mark

Reputation: 21743

This is normal for BelongsTo/HasOne Relations. As they are on the same level as your primary record. Only HasMany/Habtm relations will result in an empty sub array (since those would be an array of arrays). That is mainly due to the way the array structure is returned.

And yes, your model relations look fine to me.

Upvotes: 5

Related Questions