# |
Jul 27th 2021, 10:55 |
paolo.bragagni |
I have to modify my table.twig to add it? |
# |
Jul 27th 2021, 10:53 |
paolo.bragagni |
in my validator |
# |
Jul 27th 2021, 10:53 |
paolo.bragagni |
but in my DischiTable theres not a ->notEmpty('author_id') |
# |
Jul 27th 2021, 10:52 |
paolo.bragagni |
|
# |
Jul 27th 2021, 10:52 |
paolo.bragagni |
AND it shows in bold |
# |
Jul 27th 2021, 10:50 |
paolo.bragagni |
null for filed author_id is set to false in DB |
# |
Jul 27th 2021, 10:47 |
dereuromark |
make sure to set null=>false here in your schema |
# |
Jul 27th 2021, 10:45 |
paolo.bragagni |
where does it get the {%- if fieldData.null %} variable? |
# |
Jul 27th 2021, 10:44 |
paolo.bragagni |
It shows as it should not be empty but theres not validator? |
# |
Jul 27th 2021, 10:43 |
paolo.bragagni |
it works, but why it not puts forr defaults while I've baked the Table? |
# |
Jul 27th 2021, 10:39 |
dereuromark |
so you dont want it to be empty? then set up the validation for it to fail here before it tries to save.# |
# |
Jul 27th 2021, 10:37 |
paolo.bragagni |
and not an sql error.. !! |
# |
Jul 27th 2021, 10:37 |
paolo.bragagni |
|
# |
Jul 27th 2021, 10:36 |
paolo.bragagni |
yes but I'd like to obtain a nice popup like this |
# |
Jul 27th 2021, 10:33 |
dereuromark |
optional means: DB field is DEFAULT NULL etc |
# |
Jul 27th 2021, 10:32 |
dereuromark |
you cannot omit the author if you told the db that this isn't a possibility. either you decide for being optional or you don't :) |
# |
Jul 27th 2021, 10:30 |
paolo.bragagni |
SQLSTATE[HY000]: General error: 1364 Field 'autore_id' doesn't have a default value |
# |
Jul 27th 2021, 10:29 |
paolo.bragagni |
if I omit title I got the popup, if I omit the Author (select field) I got a DB error |
# |
Jul 27th 2021, 10:29 |
paolo.bragagni |
|
# |
Jul 27th 2021, 10:12 |
paolo.bragagni |
solved |
# |
Jul 27th 2021, 09:27 |
paolo.bragagni |
{{ action }} ?? |
# |
Jul 27th 2021, 09:26 |
paolo.bragagni |
how to get the name of the action that is baking in twig? |
# |
Jul 27th 2021, 08:17 |
dereuromark |
No, it can also be |void still |
# |
Jul 27th 2021, 06:29 |
brandon |
I can't seem to find this documented anywhere - controller actions seem to require `return null;` at the end if you aren't returning a Response to keep the code clean. No examples show this return on actions. What are the suggestions? ```Return value of Inventory\Controller\SystemsController::index() must be an instance of Cake\Http\Response or null, none returned``` |
# |
Jul 27th 2021, 01:05 |
cnizzardini |
ugh: https://github.com/slevomat/coding-standard/issues/872 |
# |
Jul 27th 2021, 01:02 |
cnizzardini |
Any idea why? |
# |
Jul 27th 2021, 01:02 |
cnizzardini |
```use SwaggerBake\Lib\MediaType\{Generic, HalJson, JsonLd};``` |
# |
Jul 27th 2021, 01:01 |
cnizzardini |
Using cakephp code sniffer i get the following error `| ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Generic.` with grouped use declarations like this: |
# |
Jul 26th 2021, 20:57 |
umer936 |
I think thats what i will end up doing. Thank you! I'm currently reworking the whole thing so if you think of other tips, I can most likely use them. :) |
# |
Jul 26th 2021, 20:51 |
greg138 |
You'd need to do something like `use \App\PlotsController as BasePlotsController;` and then `extend BasePlotsController`. That's nothing to do with Cake, just standard PHP namespacing. |
# |
Jul 26th 2021, 20:42 |
umer936 |
@greg138 That was the original thought but it complains about the controller name being used twice |
# |
Jul 26th 2021, 20:42 |
alamnaryab |
I am inserting records in 3 tables inside a transaction |
# |
Jul 26th 2021, 20:39 |
cnizzardini |
but thats all up to you |
# |
Jul 26th 2021, 20:39 |
cnizzardini |
personally, if you can, i would just support both put/post on edit in your controller action |
# |
Jul 26th 2021, 20:38 |
cnizzardini |
according to the documentation (first link) it uses POST on creates, and PUT on edits |
# |
Jul 26th 2021, 20:37 |
cnizzardini |
are you editing an existing record |
# |
Jul 26th 2021, 20:36 |
alamnaryab |
@cnizzardini `'type' => 'post'` worked but I do not know why it is switching when I am not specifying `'type' => 'post'` |
# |
Jul 26th 2021, 20:33 |
alamnaryab |
I dont know why? |
# |
Jul 26th 2021, 20:33 |
alamnaryab |
I checked HTML on even times of POST it do adds `<input type="hidden" name="_method" value="PUT">` |
# |
Jul 26th 2021, 20:30 |
cnizzardini |
i think you want `'type' => 'post'` instead of using `'method' => 'post'` |
# |
Jul 26th 2021, 20:28 |
cnizzardini |
https://book.cakephp.org/4/en/views/helpers/form.html#options-for-form-creation |