Logs for #cakephp

Page 44 of 36,922, showing 100 records out of 3,692,143 total, starting on record 4,301, ending on 4,400

# At Username Text
# May 29th 2021, 21:01 kevin.pfeifer there will always be something that makes problems with your app, its just the fact, that you need to analyse it and try to fix it in a “better way”
# May 29th 2021, 21:01 etibor thank you Kevin you really cool
# May 29th 2021, 21:00 kevin.pfeifer i had many revelations over the last 2 years working with cake like custom Bake Templates, using template elements as much as possible, the new Dependency Injection Container etc. The “deep knowledge” just comes over time so don’t stress yourself too hard ;)
# May 29th 2021, 20:58 etibor its almost the first time that i use this technique
# May 29th 2021, 20:57 etibor probably its because its uses elements, and a component
# May 29th 2021, 20:57 kevin.pfeifer sure there are many things to learn but thats coding in general in my opinion :) There will always be more to learn because we thankfully don’t stand still.
# May 29th 2021, 20:56 etibor lot of time i feel i only on the top of the iceberg
# May 29th 2021, 20:55 etibor you have soo deep knowledge, i wish i could have such as
# May 29th 2021, 20:54 kevin.pfeifer i would guess it depends on which helper it uses
# May 29th 2021, 20:53 etibor just dont understand this really, because other times the error message displayed correctly in a collactable div
# May 29th 2021, 20:53 etibor you were right
# May 29th 2021, 20:52 kevin.pfeifer well :)
# May 29th 2021, 20:52 etibor go back to the root folder: vendor/cakephp/cakephp/src/View/Helper/FormHelper.php:115: 'error' => '<div class="error-message">{{content}}</div>
# May 29th 2021, 20:52 etibor sorry i was wrong
# May 29th 2021, 20:52 kevin.pfeifer because the default error template in cake3 contains that class https://github.com/cakephp/cakephp/blob/3.x/src/View/Helper/FormHelper.php#L113
# May 29th 2021, 20:51 etibor its cake3
# May 29th 2021, 20:51 kevin.pfeifer is this your cake2 project?
# May 29th 2021, 20:50 etibor i think if grep does not show 'error-message' that means not exist
# May 29th 2021, 20:49 kevin.pfeifer so you are sure you didn’t set ```'error' => '<div class="error-message">{{content}}</div>',``` inside your form helper or some custom template?
# May 29th 2021, 20:42 etibor a strange thing happened on my form , when the field is invalid the error message class rendered as class="error-message" insted of class="error message" i tried to grep for error-message in the whole cake folder but returns nothing i dont know what could gives this class insted of the proper
# May 29th 2021, 19:37 inoas @admad freenode is dead... ##php along #maria #postgresql #javascript #elixirlang and many others moved to libre chat
# May 29th 2021, 19:36 inoas ...briding
# May 29th 2021, 19:36 inoas with bots birding?
# May 29th 2021, 19:36 inoas @admad we got discord and matrix, too?
# May 29th 2021, 18:19 ndm There's more to it, but basically, application rules ensure data integrity, and validation rules ensure request validity.
# May 29th 2021, 18:17 etibor thank you really much for your help, thats what i need just not be really clear with the terminology
# May 29th 2021, 18:11 ndm https://book.cakephp.org/3/en/orm/validation.html#applying-application-rules
# May 29th 2021, 18:11 ndm That's what I mean... application rules live in / are applied in the model, in the transaction that saves the data.
# May 29th 2021, 18:10 etibor i can implament in the controller for sure, but would be good to leave alone the controller now and add to the Model
# May 29th 2021, 18:09 ndm @etibor That sounds like a job for a custom application rule where you query the storage row and check whether the score is valid.
# May 29th 2021, 18:05 dereuromark @admad The "ADmad" release is freshly baked :) https://github.com/dereuromark/cakephp-geo/releases/tag/2.1.0
# May 29th 2021, 18:04 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, 18:00 ndm Not sure what you are referring to now. Your min/max validation? You don't know how to implement that?
# May 29th 2021, 17:58 etibor i can implement a basic validation, but validation based on different model's value dont know
# May 29th 2021, 17:57 ndm Well, basic setup could be an `existsIn()` rule for the rules checker to ensure only existing storage IDs are saved, and an `inList()` validation rule for the request data in case you need to restrict what IDs a user is allowed to select.
# May 29th 2021, 17:56 etibor and the Documents have a score field which minimal and maximal value depend on the Storage type(the storage_id)
# May 29th 2021, 17:55 etibor yes document have a storage_id field too
# May 29th 2021, 17:54 ndm So you save storage IDs?
# May 29th 2021, 17:53 etibor the select field in the Documents, its depends on Storage "b" field value
# May 29th 2021, 17:53 etibor i have two models, Documents and Storage
# May 29th 2021, 17:52 etibor so bascily i dont know how can i add the validation rule in model to make it easier
# May 29th 2021, 17:50 etibor i store the form datas in db, for example the value of select list is also stored in this table
# May 29th 2021, 17:50 ndm You need to validate anyways, there's no way around that.
# May 29th 2021, 17:50 etibor i know i can validate the data, but i have too many forms now
# May 29th 2021, 17:49 etibor yes i dont know the whole process, just have this experience that adding extra fields will thrown black whole
# May 29th 2021, 17:49 ndm You should validate and verify your data in the backend anyways... which is why I was never really a fan of that feature anyways.
# May 29th 2021, 17:47 ndm *change its name
# May 29th 2021, 17:47 ndm I don't think select options are being secured, only the field itself, for example you cannot its name.
# May 29th 2021, 17:41 etibor but if change select list element value its just saved
# May 29th 2021, 17:41 etibor little progress: adding a new input field redirect to blackhole
# May 29th 2021, 17:31 ndm IIRC on 3.8 loading the security component should be enough to enable form tampering protection.
# May 29th 2021, 17:30 ndm CSRF has nothing to do with form tampering though, except for the field that holds the CSRF token of course. Unless you mean that this also won't make CSRF protection work?
# May 29th 2021, 17:28 etibor but nothing prevented
# May 29th 2021, 17:28 etibor i also added the $this->loadComponent('Csrf');
# May 29th 2021, 17:28 ndm the default identity class proxies access to the inner object
# May 29th 2021, 17:28 etibor thank you @ndm i use cake 3.8
# May 29th 2021, 17:27 ndm Check it
# May 29th 2021, 17:26 CakeIsGreat Seems to be returning it fine, as if it manually set user_id = ... getIdentity()->id; it saves it appropriately
# May 29th 2021, 17:26 ndm @etibor Depending on your CakePHP version, form protection is now a separate component.
# May 29th 2021, 17:25 ndm CakeIsGreat: Maybe `getIdentity()` doesn't return an entity, the ORM won't save anything else.
# May 29th 2021, 17:22 etibor is there any additional todo to make working the form tampering protection?
# May 29th 2021, 17:21 CakeIsGreat Well thanks both for the help. The posts association is fixed. I just don't understand why the user association isn't being saved.
# May 29th 2021, 17:14 admad If any IRC user has a problem with freenode they can use slack/discord/matrix :)
# May 29th 2021, 17:14 ndm @ionas I have no idea about that :)
# May 29th 2021, 17:12 admad Also conventionally the join table name should be "keywords_posts". You need to follow alphabetical order when combining the words.
# May 29th 2021, 17:12 admad CakeIsGreat: setting the fK field is the right way for belongsTo and hasOne associations. Why do you have Posts hasMany Keywords? It should be belongsToMany Keywords.
# May 29th 2021, 17:10 inoas @ndm we need to move the CakePHP IRC channel / bot to irc.libra.chat I think - or at least install it there, too
# May 29th 2021, 17:09 CakeIsGreat Thank you. Yes, I *just* discovered that, but took a lot of trial and error. What I still don't get though is why I can't set "$post->user = $this->Authentication->getIdentity();" I could manually set $post->user_id but that seems to be the wrong way to go about it since it should be able to save by association anyways
# May 29th 2021, 17:08 ndm That being said, you have set up `Posts hasMany Keywords`, so when saving a post with keywords there will be no join table involved. You probably want `Posts belongsToMany Keywords` instead, ie the opposite direction of what you have on your `Keywords` table.
# May 29th 2021, 17:04 ndm @CakeIsGreat Try slack or discord, you get a proper history there.
# May 29th 2021, 16:57 CakeIsGreat Associations are all messed up. Here's a little test function and the table associations: https://pastebin.com/ZuVXkxD6 Also thanks to anyone who tried to answer me yesterday, I got disconnected immediately so didn't see any responses
# May 29th 2021, 16:47 inoas Are we movign to irc.libra.chat, too? I assume
# May 29th 2021, 13:53 etibor i thought it woul be enough but its still not prevent form field change by client
# May 29th 2021, 13:53 etibor `public function initialize(){` `parent::initialize();` `$this->loadComponent('Security');` `}` `public function beforeFilter(Event $event){` `parent::beforeFilter($event);` `$this->Security->setConfig('blackHoleCallback', 'blackhole');` `}`
# May 29th 2021, 13:52 etibor i would like to prevent form tampering
# May 29th 2021, 13:52 etibor thank you @admad its helped
# May 29th 2021, 04:06 admad CakelsGreat: Conventionally the join table name should be "keywords_posts". You need to follow alphabetical order when combining the words.
# May 28th 2021, 22:11 CakeIsGreat incorrect as it should be looking in "posts_keywords" table if I understand things correctly.
# May 28th 2021, 22:11 CakeIsGreat I have a "Posts" entity/table which has a ->hasMany('Keywords') relationship. Keywords has a ->belongsToMany('Posts') relationship. In my controller I'm doing a simple call to get a post by it's ID and containing 'Users' and 'Keywords'. Neither association is working. I'm getting an error about it looking up the keyword by Keywords.post_id which is
# May 28th 2021, 18:39 etibor but its only return text/html even for pdf too
# May 28th 2021, 18:39 etibor i tried to dicide if the page extension has pdf content-type by get_header
# May 28th 2021, 18:39 ndm Sure, but by default the regular view and the PDF view use different templates, the one's for the PDF live in the `pdf` subfolder.
# May 28th 2021, 18:38 etibor @ndm the pdf is more colorful than the pdf, the normal view is just a simple table, while pdf have colored thead for example
# May 28th 2021, 18:37 st.steinkuehler @steinkel setting the table for the CakeDC User plugin in `Application::pluginBootstrap` with `Configure::write('Users.table','Administrators')` should work? I removed the `role` from `$_accessible` in the Adminstrator Entity because I want to set the role from the frontend - but it only works for me if the table is set in the `config/users.php` .
# May 28th 2021, 18:37 ndm Why do you need to use different template names in the first place? What problem is that trying to solve=
# May 28th 2021, 18:36 etibor i have to difine somehow if the extension is pdf than use template for pdf
# May 28th 2021, 18:36 etibor unfortunately i have different template file for normal view and for the pdf
# May 28th 2021, 18:35 etibor thank you @ndm that could be almost good
# May 28th 2021, 18:28 ndm Use the view builder's `setTemplate()` method.
# May 28th 2021, 18:23 etibor do you have any hint please
# May 28th 2021, 18:23 etibor @admad
# May 28th 2021, 18:23 etibor but it does not change
# May 28th 2021, 18:23 etibor `$this->getController()->viewBuilder()->setOptions([` `'pdfConfig' => [` `'template'=>'pdf_template'`
# May 28th 2021, 18:22 etibor basically its uses the same as the template name
# May 28th 2021, 18:21 etibor in cakepdf how can i change the template file for pdf?
# May 28th 2021, 18:21 etibor hello all
# May 28th 2021, 17:26 st.steinkuehler Now I understood: the CakeDC plugin is loading the file from `config/` if the config key + value is set...sorry
# May 28th 2021, 17:04 st.steinkuehler At the moment I do not have an issue. I want to understand. If I have an solution for my needs with your `Application::pluginBootstrap` hint than I can send a PR for the CakeDC documentation...
# May 28th 2021, 17:01 st.steinkuehler The CakeDC documentation (page "Installation") is clear, becaus it works. But I do not understand why `Configure::load` has not been used and it does not work with `Configure::load('users','Users.config')`
# May 28th 2021, 16:46 chris301 Thanks mate that's the one I wanted :)