Noob to cakePHP here.
Bicycle belongsTo Stand
Stand hasMany Bicycle
Stand belongsTo Station
Station hasMany Stand
I've baked the CRUDs and now I want to display the station name when I view a bicycle. How should I define the bicycle - station relationship? Or what do I need to do to include the station model in the bicycles controller?
What I've tried so far. Which throws a "Notice (8): Undefined index: Station": BicyclesController.php:
public function index() {
$this->Bicycle->recursive = 2;
$this->set('bicycles', $this->Paginator->paginate());
}
index.ctp:
<?php echo $this->Html->link($bicycle['Station']['name'].$bicycle['Stand']['stand_no'], array('controller' => 'stands', 'action' => 'view', $bicycle['Stand']['id'])); ?>
Help!