# |
Jul 21st 2021, 14:33 |
kevin.pfeifer |
so `src/Utility/MyUtility.php` would have to have the Namespace `App/Utility` and can be accessed via `App/Utility/MyUtility::MY_CONSTANT` |
# |
Jul 21st 2021, 14:33 |
Guest481 |
yep you are right |
# |
Jul 21st 2021, 14:32 |
kevin.pfeifer |
src is mapped to the `App` namespace see composer.json |
# |
Jul 21st 2021, 14:32 |
Guest481 |
i would need to have a "use App\MyClass" at the beginning of my controller to use it ? |
# |
Jul 21st 2021, 14:31 |
Guest481 |
but if i imagine my class is in src: |
# |
Jul 21st 2021, 14:29 |
Guest481 |
hmm okay i'll give it a try |
# |
Jul 21st 2021, 14:27 |
cnizzardini |
You can create that class anywhere in `src/` that makes sense to you. You may also want to look at making this a configuration: https://book.cakephp.org/4/en/development/configuration.html |
# |
Jul 21st 2021, 14:26 |
Guest481 |
or maybe in Entity |
# |
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 ^ |