# |
Jul 21st 2021, 14:25 |
Guest481 |
any help would be apreciated |
# |
Jul 21st 2021, 14:25 |
Guest481 |
nothing found in the doc |
# |
Jul 21st 2021, 14:25 |
Guest481 |
i don't have any idea on where to create that class file (folder, etc) |
# |
Jul 21st 2021, 14:25 |
Guest481 |
by example, containing the following : CustomRole::SYSTEM_ADMIN |
# |
Jul 21st 2021, 14:24 |
Guest481 |
i would like to create a class which would have only the aim to provide constants |
# |
Jul 21st 2021, 14:23 |
Guest481 |
Hi everybody ! i have a doubt |
# |
Jul 21st 2021, 12:36 |
paolo.bragagni |
Tomorrow Ill try (today ->beach). I hope it works.. allowClear didnt worked... |
# |
Jul 21st 2021, 11:23 |
kevin.pfeifer |
or that :) |
# |
Jul 21st 2021, 11:22 |
dereuromark |
its in the docs |
# |
Jul 21st 2021, 11:21 |
dereuromark |
dont you just need a `allowClear: true` on top of the JS config for select2 to allow this? |
# |
Jul 21st 2021, 11:12 |
kevin.pfeifer |
as far as I know `'empty' => true` only adds an empty `<option>` This empty option is present in the select2 dropdown, but you barely can see/select it because it has no height (because it has no text) Try setting `'empty' => __( 'No selection' ),` |
# |
Jul 21st 2021, 11:07 |
paolo.bragagni |
In view I havent option to select empty. |
# |
Jul 21st 2021, 09:44 |
slackebot2 |
race conditions that like to happen there. |
# |
Jul 21st 2021, 09:44 |
ndm |
Maybe... it could also be that rector is broken once again. Try running the rector command that the upgrade tool generates manually. You could also try a debugger like xdebug to log traces to maybe get an idea where things possibly halt. If you already have a debugger installed and enabled, also try disabling it. Also when running in a VM, try placing the code outside of the shared folder to avoid possible file locking related |
# |
Jul 21st 2021, 07:04 |
Guest45 |
ok thanks for the ocnfirmation |
# |
Jul 21st 2021, 07:03 |
dereuromark |
controllers share the same model usually :) |
# |
Jul 21st 2021, 07:03 |
dereuromark |
models are always in one spot |
# |
Jul 21st 2021, 06:53 |
Guest45 |
do i need to create them too ? |
# |
Jul 21st 2021, 06:53 |
Guest45 |
yes ands regarding the models |
# |
Jul 21st 2021, 06:52 |
dereuromark |
you can reuse templates if you want. it is just simpler sometimes to have them separated, as e.g. admin actions usually offer different/more fields |
# |
Jul 21st 2021, 06:52 |
Guest45 |
yes but new habits hihi |
# |
Jul 21st 2021, 06:52 |
Guest45 |
grrr that means associated template i suppose |
# |
Jul 21st 2021, 06:52 |
dereuromark |
You dont have to go too crazy like Laravel that every action now has its own class. So I think having a class per routing/prefix makes a good compromise :) |
# |
Jul 21st 2021, 06:51 |
dereuromark |
yes, nowadays those are separate controllers in /Admin namespace etc |
# |
Jul 21st 2021, 06:50 |
Guest45 |
does it means a dedicated controller should be created ? |
# |
Jul 21st 2021, 06:50 |
Guest45 |
it seems that it's not possible to have prefixed actions with routing as previous versions of cake eg admin_view, admin_edit |
# |
Jul 21st 2021, 06:50 |
Guest45 |
Hi all |
# |
Jul 21st 2021, 06:47 |
dereuromark |
this is usually the default of bake templates if your DB has the field to "default NULL" |
# |
Jul 21st 2021, 06:46 |
dereuromark |
`'empty' => true` ? |
# |
Jul 21st 2021, 06:43 |
paolo.bragagni |
How to allow user to make the field blank? |
# |
Jul 21st 2021, 06:42 |
paolo.bragagni |
But I have some problem in edit view |
# |
Jul 21st 2021, 06:41 |
paolo.bragagni |
Ive integrated select2 via ajax |
# |
Jul 21st 2021, 05:10 |
brandon |
@ndm ^ |
# |
Jul 21st 2021, 05:09 |
brandon |
Brand new VM, installed PHP, Composer, all that good stuff. Checked out my repo and ran the same rector command. It still hangs in the same spot. So it has to be something with my code then, right? I fixed all the issues with cs - comes back clean. Not sure what else to look at. |
# |
Jul 20th 2021, 21:25 |
jadelbe418 |
Yup, I was just doing that. That one is pretty useful! |
# |
Jul 20th 2021, 21:24 |
kevin.pfeifer |
you should also look into the https://github.com/cakephp/cakephp/blob/084963bd27984e50174fadcbdee91048112231a0/src/Http/Middleware/BodyParserMiddleware.php if you wanna see how the body of the request can be adjusted if e.g. the content-type is json or xml |
# |
Jul 20th 2021, 21:15 |
jadelbe418 |
Cool, I have never written any either but my project is at a point where it could really use it so I am attempting to figure it out. I appreciate the help! |
# |
Jul 20th 2021, 21:12 |
slackebot2 |
helper function bellow) |
# |
Jul 20th 2021, 21:12 |
kevin.pfeifer |
I never looked that deep into these things because I never had to write a custom middleware so sorry :man-shrugging: I have already told you pretty much everything I know about middlewares ^^ But looking at https://github.com/cakephp/cakephp/blob/084963bd27984e50174fadcbdee91048112231a0/src/Http/Middleware/CsrfProtectionMiddleware.php#L120 you can see here, that this middleware adds a cookie to the response object (in a |
# |
Jul 20th 2021, 20:58 |
jadelbe418 |
But it should be able to edit a response or a request at any position? I am just am not super familiar with the concept and am wonder how the application determines at what stage in the request or the response building process to stop and fire these. Or does where the middle ware get added not effect the functionality on that level? I might be over complicating the issue in my understanding of it. |
# |
Jul 20th 2021, 20:53 |
kevin.pfeifer |
well these functions would only allow you to insert your middleware at a specific position in the middleware queue (e.g. if you would be in a plugin where you don't have direct access to the other middleware addition code) If you are happy with the position your middleware gets added inside your Application.php then sure, ->add() is totally fine |