Sometimes find returns false for not found records and sometimes it
returns empty array. At least I saw this in Cake 1.2
empty($records) check will return true for both cases of not found and
for SQL error too. Same as simple $records check.

On 7 дек, 19:08, euromark <[email protected]> wrote:
> i saw your ticket :)
> and i agree - it would be more constant if id behaved the same
>
> you could still check on if ($record = $this->find(...)) or $record
> = ...; if (!empty($record)) etc
> so the code wouldnt change at all for most people
> as long as nobody used strict comparison yet, anyway.
>
> On 7 Dez., 08:04, "[email protected]" <[email protected]> wrote:
>
>
>
>
>
>
>
> > I see...however, I do feel find('first'..) should behave like
> > find('all') where it returns false on error and empty array on empty
> > result...
>
> > On Dec 6, 8:00 pm, euromark <[email protected]> wrote:
>
> > > usually there shouldnt be any errors :)
>
> > > but you could put this in your app_model.php:
>
> > >         /**
> > >          * @return string Error message with error number
> > >          */
> > >         public function lastError() {
> > >                 $db = $this->getDataSource();
> > >                 return $db->lastError();
> > >         }
>
> > > if its not empty there was an error
>
> > > On 7 Dez., 02:10, "[email protected]" <[email protected]> wrote:
>
> > > > Hi all,
>
> > > > It appears Model->find('first', ...) returns false in both cases:
>
> > > > 1) SQL error
> > > > 2) Empty result
>
> > > > How am I supposed to know which is which if it behaves this way?
>
> > > > Thanks.

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 [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