I'm guessing that you're putting the findbyoffice function in the
wrong file - either in the controller, or a misnamed model file.
In any case, you don't need it. Completely remove that function, and
have this as your index() function:
function index() {
$this->Rapportini->recursive = 0;
$this->set('rapportinis', $this->Rapportini->findAllByOfficeId($this-
>Auth->user('office_id')));
}
This will work automagically.
hth
grigri
On Jan 20, 3:00 pm, tjr88 <[email protected]> wrote:
> Hi,
>
> I am quite new to cakephp and am having some issues with the following
> code,
>
> function findbyoffice($office = null) {
> return $this->find('all',array('conditions' =>
> array('office_id' =>
> $office)));
> }
>
> function index() {
> $this->Rapportini->recursive = 0;
> $this->set('rapportinis', $this->Rapportini->findbyoffice($this->Auth-
>
> >user('office_id')));
> }
>
> it gives me,
> SQL Error: 1054: Unknown column 'Rapportini.office' in 'where
> clause' . . . WHERE `Rapportini`.`office` = '1'
>
> Now the SQL has clearly dropped the _id section of the field.
>
> What have i done wrong??
>
> Thanks
> Tim
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---