Logs for #cakephp

Page 43 of 36,922, showing 100 records out of 3,692,143 total, starting on record 4,201, ending on 4,300

# At Username Text
# May 29th 2021, 22:01 kevin.pfeifer has already the connected entities in there
# May 29th 2021, 22:01 kevin.pfeifer but your $entity
# May 29th 2021, 22:01 kevin.pfeifer basically the same procedure as before
# May 29th 2021, 22:00 kevin.pfeifer ``` public function buildRules( RulesChecker $rules ): RulesChecker { $rules->add(function ($entity, $options) { // Return a boolean to indicate pass/failure xdebug_break(); $tmp = ""; return true; }, 'ruleName'); return $rules; }```
# May 29th 2021, 22:00 kevin.pfeifer is a custom rule
# May 29th 2021, 22:00 kevin.pfeifer what you need
# May 29th 2021, 22:00 kevin.pfeifer not with anything different
# May 29th 2021, 22:00 kevin.pfeifer ```public function validationDefault( Validator $validator ): Validator {``` is only meant to validate the data directly associated with the current model
# May 29th 2021, 21:59 kevin.pfeifer forget what i said above
# May 29th 2021, 21:59 kevin.pfeifer yes
# May 29th 2021, 21:59 kevin.pfeifer ha ok
# May 29th 2021, 21:59 kevin.pfeifer i guess my solution above is a bit too hacky
# May 29th 2021, 21:56 kevin.pfeifer lets check the docs
# May 29th 2021, 21:55 kevin.pfeifer to check the connected entity
# May 29th 2021, 21:55 etibor yes min and max values can be change in the future
# May 29th 2021, 21:55 kevin.pfeifer i guess you would need to have the same logic on the other model as well
# May 29th 2021, 21:55 kevin.pfeifer but after e.g. 1 day these min and max values change and the connected entity is then wrong?
# May 29th 2021, 21:54 etibor if not with depending on the values of another entity
# May 29th 2021, 21:54 kevin.pfeifer I am just thinking that through What if your first “add” action works because your connected storage entity has valid min and max values
# May 29th 2021, 21:54 etibor but how would you deal with that?
# May 29th 2021, 21:53 etibor okey i found in my directory the Factory Locator
# May 29th 2021, 21:53 kevin.pfeifer depending on the values of another entitiy
# May 29th 2021, 21:53 kevin.pfeifer to have input validation present
# May 29th 2021, 21:53 kevin.pfeifer but I personally never had that case to be honest
# May 29th 2021, 21:52 kevin.pfeifer its present
# May 29th 2021, 21:52 kevin.pfeifer https://github.com/cakephp/cakephp/blob/3.x/src/Datasource/FactoryLocator.php
# May 29th 2021, 21:52 kevin.pfeifer ah wait
# May 29th 2021, 21:52 kevin.pfeifer but seems like that factory locator is also present in cake3 so it should work :) https://github.com/cakephp/cakephp/blob/master/src/Datasource/FactoryLocator.php
# May 29th 2021, 21:52 etibor i am looking for the using of FactoryLocator Class in Cake but at first sight its seem its for cake4
# May 29th 2021, 21:50 kevin.pfeifer and with that table object you can then (as like you where in the controller or in the model of that table) load entities and check their fields
# May 29th 2021, 21:49 kevin.pfeifer you can basically load any table from anywhere when you have a Table Locator Object
# May 29th 2021, 21:49 kevin.pfeifer ``` 'rule' => function( $value, $context ) { // Get the selected $selected_storage_id = $context['data']['storage_id']; $table_locator = FactoryLocator::get('Table'); $StorageTable = $table_locator->get('Storage'); $storage_entity = $StorageTable->get($selected_storage_id); if($storage_entity->somefield < value || $storage_entity->otherfield >
# May 29th 2021, 21:49 slackebot $value){ return false; // Invalid! } return true; },```
# May 29th 2021, 21:48 kevin.pfeifer but i would do something like that
# May 29th 2021, 21:48 kevin.pfeifer i don’t know if you have the FactoryLocator Class in Cake 3
# May 29th 2021, 21:46 etibor thank you Kevin
# May 29th 2021, 21:45 kevin.pfeifer yea i am currently in the process of preparing that
# May 29th 2021, 21:44 etibor "the only thing you need to do by hand in there is load the values from your other Table" - this part i dont really know how to do it
# May 29th 2021, 21:44 etibor how The main Model is dependent on the Other Model's field value
# May 29th 2021, 21:43 etibor ```function( $value, $context ) { // ... some logic return true; },``` As i good unserstand here will declarete
# May 29th 2021, 21:42 kevin.pfeifer the only thing you need to do by hand in there is load the values from your other Table
# May 29th 2021, 21:42 kevin.pfeifer and basically you can add any custom rule you want to any field
# May 29th 2021, 21:42 kevin.pfeifer this is inside my Tables ```public function validationDefault( Validator $validator ): Validator {``` function
# May 29th 2021, 21:41 kevin.pfeifer ``` $validator->boolean( 'is_done' ) ->allowEmptyString( 'is_done' ) ->add( 'is_done', 'check_is_done_fields', [ 'rule' => function( $value, $context ) { // ... some logic return true; }, 'message' => __d('alfred_projects', 'Please fill out all necessary fields to close a project' ) ] );```
# May 29th 2021, 21:40 etibor thank you Kevin, i stuck by the buildRules
# May 29th 2021, 21:38 kevin.pfeifer let me grab one of my examples
# May 29th 2021, 21:38 kevin.pfeifer well this would be perfect for a custom validation rule I would guess
# May 29th 2021, 21:38 kevin.pfeifer i see
# May 29th 2021, 21:38 kevin.pfeifer ahh
# May 29th 2021, 21:37 etibor well, the first part is right, and the second is a bit different, Documents stores the score field, and Storage stores the score minimal and maximal value(there can be different Storeges) and Document's instances have storage_id
# May 29th 2021, 21:35 kevin.pfeifer am i right?
# May 29th 2021, 21:33 kevin.pfeifer so Storage hasMany Documents and Documents BelongsTo Storage And you want to “restrict” the selection of available Storage inside your Documents Model so they are “filtered” according to your logic
# May 29th 2021, 21:32 etibor how can i deal in DocumentsTable.php with the StorageModel ? I have never worked with this like before
# May 29th 2021, 21:31 etibor the scenerio is like : Documents have an storage_id, score field(store an int) the maximal and minimal value is stored in the storage Model so Document's score depend on Storage minimal and maximal field
# May 29th 2021, 21:29 kevin.pfeifer an example would be easier i would guess so i don’t describe the “wrong” thing
# May 29th 2021, 21:29 etibor i havent found any description regarding to this
# May 29th 2021, 21:29 etibor how can i implement application validation rule(RulesCheckers) i need to validate one Model depends on ther Model's field value
# May 29th 2021, 21:28 etibor Kevin just one last questrion for today
# May 29th 2021, 21:27 kevin.pfeifer and see which errors/warnings etc. popup and fix them as they come
# May 29th 2021, 21:27 kevin.pfeifer but basically I would just upgrade via composer, set your ```'Error' => [ 'errorLevel' => E_ALL, ]``` in your app.php
# May 29th 2021, 21:26 kevin.pfeifer here is a list of all “deprecated” classes etc. https://book.cakephp.org/4/en/appendices/4-0-migration-guide.html
# May 29th 2021, 21:26 kevin.pfeifer if you are used to cake3 then cake4 is not different at all
# May 29th 2021, 21:25 etibor i hope i will manage not so hard the change
# May 29th 2021, 21:25 etibor well for myself it was a disaster when i used to the 2 and i have to change, but thank you for calming me
# May 29th 2021, 21:24 kevin.pfeifer and as stated - an upgrade from cake3 to cake4 is definetly not as hard as cake2 to cake3
# May 29th 2021, 21:24 kevin.pfeifer but keeping your software up2date is pretty normal I would say ^^
# May 29th 2021, 21:24 kevin.pfeifer i would guess there will be more “public warnings” when the time comes near
# May 29th 2021, 21:23 etibor thank you for warning me for this "dead" line
# May 29th 2021, 21:21 kevin.pfeifer which means now you have 1.5 years
# May 29th 2021, 21:21 etibor ooo
# May 29th 2021, 21:21 kevin.pfeifer so till the end of 2022
# May 29th 2021, 21:21 kevin.pfeifer well 3 years counting from 16 Dec 2019
# May 29th 2021, 21:20 kevin.pfeifer but could be that the core team has decided on some other roadmpa
# May 29th 2021, 21:20 etibor so its means having 3 years for prepare for upgrading
# May 29th 2021, 21:20 kevin.pfeifer so you get 3 years of security fixes for 3.x
# May 29th 2021, 21:19 kevin.pfeifer https://github.com/cakephp/cakephp/releases/tag/4.0.0
# May 29th 2021, 21:19 kevin.pfeifer 4.0.0 release on 16 Dec 2019
# May 29th 2021, 21:18 kevin.pfeifer Our current plans would make the 3.x to 4.0 upgrade relatively easy. Because of this we don’t currently see many reasons to continue doing 3.x feature releases. This would make 3.6 the last 3.x with the possibility of 3.7 happening. If there is enough community interest in it. Furthermore, we plan on doing supporting 3.x with: • Bug fixes for _18 months_ after 4.0.0. • Security fixes for _36 months_ after 4.0.0
# May 29th 2021, 21:18 slackebot is released. Our hope is that these time frames give you and your teams ample time to plan and execute an upgrade.
# May 29th 2021, 21:18 kevin.pfeifer well if we look in here
# May 29th 2021, 21:18 kevin.pfeifer https://bakery.cakephp.org/2017/06/23/upcoming-cakephp-roadmap.html
# May 29th 2021, 21:18 etibor sounds not good
# May 29th 2021, 21:17 kevin.pfeifer the fact that cakephp2 just now is going EOL
# May 29th 2021, 21:17 kevin.pfeifer well
# May 29th 2021, 21:16 etibor do you think cake3 will be supported its longer?
# May 29th 2021, 21:08 etibor okey you right no offtopic
# May 29th 2021, 21:07 etibor so i trust i will be able to use cake3 for a while
# May 29th 2021, 21:07 kevin.pfeifer lets continue in a thread or in a DM to not distrub all others here in the support channel, ok^^
# May 29th 2021, 21:07 etibor and i remember that i gave up my first app without finishing, and began everything from scratch
# May 29th 2021, 21:06 etibor i began my first app in cake2 the time when it was the master version
# May 29th 2021, 21:05 etibor just one thing i worry a lot, its the upgrading to 4, my application becames huge, i am afraid it will not possible to convert simle way
# May 29th 2021, 21:05 kevin.pfeifer working solutions (even badly designed/implemented) are better than no solutions :) but if you already know that there is a “better way” then you can at least take the time later on to improve and refactor your app
# May 29th 2021, 21:04 etibor sometimes my solution are not the most smooth and elegant but keep working to learn
# May 29th 2021, 21:03 etibor when page display error during
# May 29th 2021, 21:03 etibor hahah i did it live application, sometimes users became crazy
# May 29th 2021, 21:02 kevin.pfeifer thats one thing i hoped i learned sooner than later
# May 29th 2021, 21:02 kevin.pfeifer are you using tests already? :)
# May 29th 2021, 21:02 etibor luckily i am able to handle most of the things
# May 29th 2021, 21:01 etibor yes i have the same feeling that its gonna be never perfect
# May 29th 2021, 21:01 kevin.pfeifer whichever it is it that moment