English 中文(简体)
CakePHP:Nll Values回归模型
原标题:CakePHP: Model Returning Null Values
  • 时间:2012-05-19 22:36:06
  •  标签:
  • cakephp

我与我的协会有一些问题。 我有3个模型:用户、会员、公司。 用户(或不得)拥有公司/成员。 这里是我模式的主轴:

rel=“nofollow”>http://pastebin.com/xTCQeytn

2 问题 我有:

  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?
最佳回答

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.

是的,你们的模范关系对我来说是好的。

问题回答

暂无回答




相关问题
PHP Framework: Ebay Like Site

I am going to be builiding a site like ebay - with all the features of ebay. Please note my payment method is limited to paypal. What would be the best PHP framework to use to build this quickly, ...

specifying date format when using $form->inputs() in CakePHP

I am wondering if there is a way to specify the date format in the forms created using CakePHP s $form->inputs(); Please note that this is not the individual $form->input() but instead $form->inputs() ...

Using DISTINCT in a CakePHP find function

I am writing a CakePHP 1.2 app. I have a list of people that I want the user to be able to filter on different fields. For each filterable field, I have a drop down list. Choose the filter ...

Assistance with CakePHP model relationships

How would I represent the following in a CakePHP model? Product ======= product_id .... Cart ==== cart_id .... Carts_Products ============== cart_id product_id quantity

Prevent controller from trying to autoload model

I am a beginning Cake user and trying to do some work on an already existing application. Running into a problem when I create a new controller. I have created StoreController and when I try to call ...

热门标签