It might be helpful if you include all the SQL being executed by Cake,
and how you have defined the relationship...



On Apr 21, 11:59 pm, sumanpaul <[EMAIL PROTECTED]> wrote:
> Ok the situation is bit complicated (to me atleast :P)
> I will try my best to explain .
>
> 1. I am using cake 1.2
>
> 2. Windows env, apache, mysql, php 5
>
> Now I am making a personal financing app, where i have users,
> transactions, tables. I am storing all transaction with user_id and I
> have hasMany relation between user & transaction.
>
> I have created a view
>  ==> "select `transactions`.`user_id` AS
> `user_id`,sum(`transactions`.`amount`) AS `total` from `transactions`
> group by `transactions`.`user_id`"
> which returns
>
> view name = balances
> uers_id      total
> ------------------------
> 1               1200
> 2                900
>
> the user has "hasOne" relation with balances.
>
> when I use
> $this->set('user', $this->User->read(null, $id));
>
> in user_controllers.php I am getting
>
>     [Balance] => Array
>         (
>             [total] => 2939.20
>         )
> in the view ... no issues with this. But I am also getting
>
>     [transactions] =>
>
> now this is causing problem.
>
> the whole array is something like this
>
> Array
> (
>     [User] => Array
>         (
>             [id] => 1
>             [created] => 2007-04-07 10:21:23
>             [modified] => 2007-04-09 12:50:26
>             [username] => suman
>             [password] => 5f4dcc3b5aa765d61d8327deb882cf99
>             [name] => Suman Paul
>             [group_id] => 1
>             [active] => 1
>         )
>     [transactions] =>
>     [Balance] => Array
>         (
>             [total] => 2939.20
>         )
> .........
>
> At top I am getting an error ...
> Notice (8): Undefined index:  transactions [CORE\cake\libs\model
> \datasources\dbo_source.php, line 685]
>
> I understand that the error is due to blank [transactions] => and
> thats becuse of the view I created.
> but I was wondering why it is coming.
>
> any body could shed any light, that will be really helpful.
>
> reagrds
> suman


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to