Log message #4268084

# At Username Text
# Jul 21st 2021, 14:59 kevin.pfeifer I too myself just recently refactored a bunch of arrays and other primitive data from their respected classes into actual config arrays ,:)
# Jul 21st 2021, 14:58 Guest481 yes for now i'll do like that and when my project will be more complete i'll tune all of that
# Jul 21st 2021, 14:56 kevin.pfeifer but thats something you can pretty easiely adjust at a later time if you so desire
# Jul 21st 2021, 14:55 kevin.pfeifer but as said from cnizzardini if these constants are "just" strings or integers then a config entry would be much easier to work with
# Jul 21st 2021, 14:54 Guest481 many thanks for your precious advice
# Jul 21st 2021, 14:53 kevin.pfeifer if you have logic which should be present in many controllers then sure, a component is meant for that But the moment you need that same logic somewhere else (e.g. inside a Command) the generic PHP Class approach is better
# Jul 21st 2021, 14:51 kevin.pfeifer you shouldn't call controller methods from other parts in the framework because they are only meant to be invoked via URLs (/my-controller/my-function) You should rather refactor that logic inside your controller function into sort of generic class which then can be called from your controller or anywhere else you want.
# Jul 21st 2021, 14:35 Guest481 a component is better maybe ?
# Jul 21st 2021, 14:35 Guest481 hmm and to call a method from a controller ?
# 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