Hi Jeramy,

thank you very much, As u said error was there. thanks you again for saving
my time!

---------- Forwarded message ----------
From: Jeremy Burns | Class Outfit <[email protected]>
Date: Wed, Jun 22, 2011 at 1:38 PM
Subject: Re: cake model association error
To: [email protected]


Try this instead:

:::::::::::::Subalbum model:::::::

var $belongsTo = array('Album');

Jeremy Burns****
*Class Outfit*
*
*
[email protected] <[email protected]>
http://www.classoutfit.com

On 22 Jun 2011, at 08:54, madusanka hettiarachchi wrote:

HI guys,

Im new to cake! I made a association between two models called "Album" and
"Subalbum".
association should be like this,

Subalbum hasOne Album
Album hasMany Subalbums

bt I got error like this,
*
1054: Unknown column 'Album.subalbum_id' in 'on clause'
[CORE\cake\libs\model\datasources\dbo_source.php, line 684]

*SELECT `Subalbum`.`id`, `Subalbum`.`sub_album_name`,
`Subalbum`.`date_created`, `Subalbum`.`last_modified_date`,
`Subalbum`.`music_id`, `Subalbum`.`size`, `Subalbum`.`album_id`,
`Album`.`id`, `Album`.`album_name`, `Album`.`sub_directory`,
`Album`.`create_date`, `Album`.`last_modified_date`, `Album`.`music_id`,
`Album`.`album_category`, `Album`.`album_description`, `Album`.`user_id`,
`Album`.`size` FROM `subalbums` AS `Subalbum` LEFT JOIN `albums` AS `Album`
ON (`Album`.`subalbum_id` = `Subalbum`.`id`)  WHERE 1 = 1

error occuerd due to highlighted part of the query, it should be
(`Album`.`subalbum_id`
= `Subalbum`.`id`)

here are my codes

:::::::::::::Subalbum model:::::::

var $hasOne = array('Album');

:::::::::::::Album model ::::::::::::::::::::

var $hasMany = 'Subalbum';


can any body help me?
-- 
Ganganath Hettiarachchi

-- 
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php


 --
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php



-- 
Ganganath Hettiarachchi
Faculty of Information Technology
UOM

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to