$this->set('properties', $this->Property->Property->generateList());

should be

$this->set('properties', $this->Photo->Property->generateList());

jamiec:
> I am new to using cake and am having difficulty at one of the first
> hurdles of my first application (outside of all the tutorials I've
> done!)
>
> I have three models:
> Property
> Dealers
> Photos
>
> Dealers have many properties, properties have many photos.
>
> Through reusing code from a tutorial, when adding a property, I can
> get a dropdown of all the dealers. The code looks something like this:
>
> <?php
>
> class PropertiesController extends AppController {
>
>
>
>     var $name = 'Properties';
>
>     var $helpers = array('Html', 'Form' );
>
>
>
>     function index() {
>
>         ...
>
>     }
>
>
>
>     function add() {
>
>         if (empty($this->data)) {
>
>             $this->set('dealers', $this->Property->Dealer-
> >generateList());
>
>             $this->render();
>
>         } else {
>
>             // create property
>
>             }
>
>         }
>
>     }
> ?>
>
> However, when I try and reuse similar code in the Photos controller,
> such as this:
>
>
> <?php
>
>
>
> class PhotosController extends AppController {
>
>     var $name = 'Photos';
>
>     var $helpers = array('Html', 'Form' );
>
>
>
>     function add()
>
>     {
>
>         if (empty($this->data)) {
>
>         $this->set('properties', $this->Property->Property-
> >generateList());
>
>         $this->render();
>
>         }
>
>         else
>
>         {
>
>             // add photo
>
>         }
>
>     }
>
>
>
> }
>
> ?>
> I get horrific errors like this:
> Notice: Undefined property: PhotosController::$Property in /
> Applications/MAMP/htdocs/property_inv/app/controllers/
> photos_controller.php on line 9
>
> Notice: Trying to get property of non-object in /Applications/MAMP/
> htdocs/property_inv/app/controllers/photos_controller.php on line 9
>
> Fatal error: Call to a member function generateList() on a non-object
> in /Applications/MAMP/htdocs/property_inv/app/controllers/
> photos_controller.php on line 9
>
> Can anyone offer any help on this?
>
> thanks


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