I want to add column in my existing table in cakephp 3.
My ContactsTable.php file code is…
<?php
namespace App\Model\Table;
use Cake\ORM\Table;
use Migrations\AbstractMigration;
class ContactsTable extends Table
{
public function initialize(array $config)
{
$this->addBehavior('Timestamp');
$table = $this->table('contacts');
$table->addColumn('price', 'decimal')->update();
}
}
I have tried as cakephp 3 documentation but I got error…
Call to a member function addColumn() on a non-object
How do I add columns on-the-fly via the controller?
This question has an answer. at http://stackoverflow.com/questions/37362123/dynamically-add-columns-in-an-existing-table-on-the-fly-in-cakephp-3 but the cache is not getting refreshed on debug false.