Hi all, I am facing issue and my code are below.Please help me how can i fixed that issue...
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\ORM\Table;
use Cake\Event\Event;
use Cake\ORM\Query;
use Cake\ORM\TableRegistry;
use Cake\Routing\Router;
use App\Model\Entity\Role;
use Cake\Datasource\ConnectionManager;
use Cake\View\Helper\HtmlHelper;
use Cake\View\View;
use Cake\Core\Configure;
use Cake\Network\Exception\ForbiddenException;
use Cake\Network\Exception\NotFoundException;
use Cake\View\Exception\MissingTemplateException;
use Cake\Collection\Collection;
use Faker;
class BillsController extends AppController
{
public function initialize()
{
parent::initialize();
$this->loadComponent('RequestHandler');
}
public function index(){
$bill = $this->Bills->newEntity();
if ($this->request->is('post')) {
$bill = $this->Bills->patchEntity($bill, $this->request->data);
$bill = $this->request->data('product_id');
$products = TableRegistry::get('Products');
$query = $products->find('list');
$bill = $query->toArray();
if ($this->Bills->save($bill)) {
$this->Flash->success(__('The billNo has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The billNo could not be saved. Please, try again.'));
}
$this->set(compact('bill'));
$this->set('_serialize', ['bill']);
}
}
?>
Looks like you should review the blog tutorial as your code is fundamentally different - as is apparent from the error you receive.
This is not a help forum. The ticket tracker is reserved for possible
bugs and feature enhancements to the CakePHP framework. If you are
looking for help on how to implement a feature or to better understand
how to use the framework correctly, please visit one of the following:
The CakePHP Manual
The CakePHP online API
CakePHP Official Forum
Stackoverflow
Slack channel
or the #cakephp channel on irc.freenode.net, where we will be more than
happy to help answer your questions.
Thanks!
As for your exception: The message is very clear on that one, please read it, compare the method expectation with what you pass, read the docs and you will most certainly figure it out.
Most helpful comment
As for your exception: The message is very clear on that one, please read it, compare the method expectation with what you pass, read the docs and you will most certainly figure it out.