Closed johnchadwick closed 9 years ago
I'm wrong, don't need this yet.
It looks like the construct code is tied to the FeedsControllerFactory. I get error: Argument 1 passed to BabyMonitor\Controller\FeedsController::__construct() must be an instance of BabyMonitor\Tables\FeedTable To make this work, where you click to edit, I had to go the way of the zend online tutorial, which is: if ($feed = $this->getFeedTable()->fetchById($feedId)) { $form->setData($feed->getArrayCopy()); Below add the function: public function getFeedTable(){ if(!$this->feedTable){ $sm = $this->getServiceLocator(); $this->feedTable = $sm->get('BabyMonitor\Tables\FeedTable'); } return $this->feedTable; }
Also same idea for the save: $feed->feedId = $this->getFeedTable()->save($feed);
I've updated all references to _feedTable
to feedTable
in the chapter on controllers and actions and that'll be available in the next release of the book.
Page 92: At this point you must add declarations and construct to support: $this->_feedTable (you later changed code to $this->feedTable) This code: use BabyMonitor\Tables\FeedTable; /* * @var FeedTable / protected $feedTable;
public function __construct(FeedTable $feedTable) { $this->_feedTable = $feedTable; }