Removing id from cakphp form action
<form id="RecipeEditForm" method="post" action="/recipes/edit/5">
I need to remove /5 from the form action how can i do. I am using Cakephp 3.
See also questions close to this topic
Cakephp 3.6.14: $dateObject->i18nFormat('dd MMM, yyyy h:mm:ss a ') wrong time
Datetime in database is :
2019-02-15 10:00:00when I use this code to format and display it
$dateObject->i18nFormat('dd MMM, yyyy h:mm:ss a ');
I get wrong datetime (2 hours ahead):
15 Feb, 2019 12:00:00 am
How I can fix that?
which framework / language is best for web based ERP?
- cake php
- slim php
- Zend or
BelongsToMany associations in CakePHP 3, how to keep relations and save associations in a secondary field?
I need help to create a belongsToMany relation between 2 tables. I need this relation to be permanent and the "state of the relation" to be stored in an additional field in the relation table.
Here goes some background. I'm buildind a website for a restaurant.
This restaurant has a few cards (Brasserie, Gastronomique...):
id | name | description
Every card has many sections (Starters, Salad, Meat, Fish...). Every section may happen in multiple cards.
id | name | description | comment
Cards and Sections have a
belongsToManyrelation thanks to a table
id | carte_id | rubrique_id| order | description | comment | active (boolean)
I need this relation to be permanent. The relation may be temporarly removed as some sections may be seasonal but I need to keep the order, description and comment to be saved.
I've tried 'saveStrategy' => 'append' but this only adds new records to cartes_cartes_rubriques.
$this->belongsToMany('Rubriques', [ 'foreignKey' => 'carte_id', 'targetForeignKey' => 'rubrique_id', 'through' => 'cartes_rubriques' ]);
$this->belongsToMany('Cartes', [ 'foreignKey' => 'rubrique_id', 'targetForeignKey' => 'carte_id', 'through' => 'cartes_rubriques' ]);
$this->belongsTo('Cartes', [ 'foreignKey' => 'carte_id', 'joinType' => 'INNER' ]); $this->belongsTo('CartesRubriques', [ 'foreignKey' => 'cartes_rubrique_id', 'joinType' => 'INNER' ]);
My strategy would ideally be to save theses relations and toggle cartes_cartes_rubriques.active.
Does this seem to be a good / possible strategy?
How can I make the toggeling on cartes_cartes_rubriques.active?
Do you have a better option?
Thanks for your help. Antonio