More "bad" example:

Code is:
$this->AlbumSong->find('count', array('conditions' =>
array('AlbumSong.album_id' => 48784, 'AlbumSong.song_id' => 846847)))

Yet, the SQL is:
SELECT COUNT(*) AS `count` FROM `albums_songs` AS `AlbumSong`   WHERE
`Song`.`name` = 'Garota de Ipanema' AND `Song`.`artist_id` = 5123

It makes no sense to me at all. I really want this to be MY mistake
and not Cake's because I need to trust Cake in my projects. Please
help.

On Nov 19, 12:10 am, "qua...@gmail.com" <qua...@gmail.com> wrote:
> I am still having the same problem. I looked thruough the SQL
> statements and even on good ones such as this one:
> UPDATE `genres` SET `source_id` = 0, `id` = 273, `library_count` =
> 556, `modified` = '2010-11-18 23:08:02'  WHERE `genres`.`id` = 273
>
> It still looks bad to me. Why would Cake set id to 273 when WHERE is
> already saying it is updating Genre id 273?
>
> I also see statements like this 3 in a row:
> SELECT COUNT(*) AS `count` FROM `genres` AS `Genre`   WHERE
> `Genre`.`id` = 273
> SELECT COUNT(*) AS `count` FROM `genres` AS `Genre`   WHERE
> `Genre`.`id` = 273
> SELECT COUNT(*) AS `count` FROM `genres` AS `Genre`   WHERE
> `Genre`.`id` = 273
>
> Why? What would prompt Cake to execute that three 3 times in a row?
>
> I'm very frustrated at this point. I don't know how I can trust Cake
> to deal with my data anymore...
>
> On Nov 17, 9:36 am, "qua...@gmail.com" <qua...@gmail.com> wrote:
>
> > Thanks I will try them.
>
> > The weird thing is I can't reproduce it consistently...I mean it WILL
> > happen eventually, but WHERE and WHEN it happens is never the same.
>
> > By the way, can models have both HABTM and hasMany-Thru relationships
> > at same time?
>
> > On Nov 17, 8:49 am, keymaster <ad...@optionosophy.com> wrote:
>
> > > Weird.
>
> > > Things I might try:
>
> > > 1. clear all cached files, models, cake core persistent files,  and
> > > session files in tmp/ then try again
> > > 2. try with debug off, then turn it back on.
> > > 3. do you have any weird, unusual inheritance going on in the app,
> > > with models?
> > > 4. check your associations
> > > 5. check your $useTable
> > > 6. check the schema var to see what cake things your tables look like.
> > > 7. if you are passing field names to cake in variables, check the
> > > contents of the variable to see it is not your code.
> > > 8. Try to reproduce the problem as consistently as you can, then
> > > simplify to the bone, cut models, associations, etc. to narrow down.
> > > If you can produce a simple testcase that fails, open a ticket in
> > > lighthouse.
>
> > > On Nov 16, 8:45 pm, cricket <zijn.digi...@gmail.com> wrote:
>
> > > > On Tue, Nov 16, 2010 at 1:37 PM, qua...@gmail.com <qua...@gmail.com> 
> > > > wrote:
> > > > > I do call Create() before any Save operation. You think I need to do
> > > > > that even for Read operation?
>
> > > > Possibly. Are you reading inside a loop? But I won't speculate without
> > > > seeing more code.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to