Thursday, October 18, 2012

Re: Error: Call to a member function find() on a non-object

I can't get debug($this) to work in Cake 2.2.2.

It may be different in Cake 2.2.2 but I haven't been able to figure it out.  I have installed the DebugKit plugin.

On Thursday, October 18, 2012 12:36:00 PM UTC-5, jsundquist wrote:
The error has nothing to do with your view.  It will have to do with either your model or your controller.  As people have previously stated can you do a debug($this) before and after your find? It will show if the Address model is actually loaded or not.  If its not loaded then your find method will for sure not work.

On Thu, Oct 18, 2012 at 12:09 PM, Russell Brown <ru...@russsoftware.com> wrote:
Ok.  I changed the index.ctp as shown in the pertinent section of code as follows (but I still get the same error):

 foreach ( $address_list as $line ) {
  $address = $line['Address'];
echo
'<tr>'.
'<td>'.$address[0]['id'].'</td>'.
/* '<td>'.$this->Html->link($address['first_name'], array('action'=>'view', 'id'=>$address['id'])).'</td>'.
*/

'<td>'.$this->Html->link($address['first_name'], array('action'=>'view', 'id'=>$address[0]['id'])).'</td>'.
'<td>'.$address['last_name'].'</td>'.
'<td>'.$address['email'].'</td>'.
'<td>'.$address['phone'].'</td>'.
'<td>'.$address['address'].'</td>'.
'<td>'.$this->Html->link('edit', array('action'=>'edit', 'id'=>$address[0]['id'])).' '.

$this->Html->link('delete', array('action'=>'delete', 'id'=>$address[0]['id'])).'</td>'.



On Wednesday, October 17, 2012 9:27:07 AM UTC-5, PlanoCoder wrote:
Pull your Array

you may need to change

'<td>'.$address['id'].'</td>'.

to

'<td>'.$address[0]['id'].'</td>'.

or something like that

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake...@googlegroups.com.
To unsubscribe from this group, send email to cake-php+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: