updating translate recursive handling, fixes #5593

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7823 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-11-04 01:41:27 +00:00
parent f2823e85d7
commit e2a5f38b36

View file

@ -115,14 +115,16 @@ class TranslateBehavior extends ModelBehavior {
if (empty($query['fields'])) {
$query['fields'] = array($model->alias.'.*');
foreach (array('hasOne', 'belongsTo') as $type) {
foreach ($model->{$type} as $key => $value) {
if ($model->recursive >= 0) {
foreach (array('hasOne', 'belongsTo') as $type) {
foreach ($model->{$type} as $key => $value) {
if (empty($value['fields'])) {
$query['fields'][] = $key.'.*';
} else {
foreach ($value['fields'] as $field) {
$query['fields'][] = $key.'.'.$field;
if (empty($value['fields'])) {
$query['fields'][] = $key.'.*';
} else {
foreach ($value['fields'] as $field) {
$query['fields'][] = $key.'.'.$field;
}
}
}
}