When I try to create a form with <?= $this->Form->create($mealplan) ?>
, I get the error message: Undefined variable: mealplan
So I try to declare mealplan in the controller with $this->set(‘mealplan’, $mealplan); but that also returns the error: Undefined variable: mealplan
In the MealplansTable I have this:
namespace App\Model\Table;
use Cake\ORM\Table;
class MealplansTable extends Table
{
public function initialize(array $config): void
{
$this->hasMany('Users', [
'foreignKey' => 'user_id',
]);
}
}
How do I create my mealplan form?