Tuesday, October 27, 2009

Re: Strange belongsTo problem

On Oct 27, 3:37 pm, John Andersen <j.andersen...@gmail.com> wrote:
> Please copy/paste the actual model associations from each model, so
> that we may better be able to help you ;)
> Enjoy,
> John

from page.php
class Page extends AppModel {

public $name = 'Page';

public $validate = array(
'title' => array('notempty'),
'parent_id'=>array('notempty'),
'link_name'=>array('notempty'),
'script'=>array('notempty'),
'layout'=>array('notempty'),
'meta_description'=>array('notempty')
);

public $hasMany = 'DisplayArea';
.
.
.
}

From display_area.php
class DisplayArea extends AppModel {

public $name = 'DisplayArea';

public $validate = array(
'name' => array('notempty')
);

public $hasMany = 'ContentBlock';
public $belongsTo = 'Page';
.
.
.
}

From content_block.php
class ContentBlock extends AppModel {

public $name = 'ContentBlock';

public $validate = array(
'display_order'=>array('notempty')
);

public $hasOne = 'Image';
public $belongsTo = 'DisplayArea';
.
.
.
}

From image.php
class Image extends AppModel {

public $name = 'Image';

public $belongsTo = 'ContentBlock';
.
.
.
}

Ken
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: