# |
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 :) |
# |
May 28th 2021, 16:38 |
steinkel |
or send a PR to the file with an example of your issue and how you fixed it, it'll help others in the same situation, thanks! |
# |
May 28th 2021, 16:37 |
steinkel |
we can add that to the documentation for sure! |
# |
May 28th 2021, 16:36 |
st.steinkuehler |
@steinkel OK, I get it, but isn't it documented? Thanks for the hint to override - that's exactly what I wanted and that's why I tried to understand the config loading of the CakeDC plugin better. |