# |
Jun 29th 2021, 12:02 |
conehead |
Ah yes, the find is missing in the second |
# |
Jun 29th 2021, 12:02 |
conehead |
Yes, Users and Books have "Tags" defined. There is no real custom configuration |
# |
Jun 29th 2021, 11:58 |
dereuromark |
or 4.1 - but the 2nd one doesn't even issue a find(), that's weird.. this shouldn't even be working IMO |
# |
Jun 29th 2021, 11:56 |
dereuromark |
4.2 is a bit more strict. Looks like you defined it somewhere else already, and the plugin sets up its own relations by default. best to rename the custom ones you set up or remove them etc. |
# |
Jun 29th 2021, 11:55 |
conehead |
Yes that behavior |
# |
Jun 29th 2021, 11:53 |
kevin.pfeifer |
or is it a custom behavior you created? |
# |
Jun 29th 2021, 11:50 |
kevin.pfeifer |
you mean from the behavior from this plugin? https://github.com/dereuromark/cakephp-tags |
# |
Jun 29th 2021, 11:36 |
conehead |
Happens when upgrading from 4.0.5 to 4.1.7 |
# |
Jun 29th 2021, 11:33 |
erwane |
You can set defaultConnection in your Model table class. If your Datasource support SQL, yes, you can use the ORM but maybe it need a special driver. |
# |
Jun 29th 2021, 11:33 |
conehead |
Both tables are using the Tags behaviorBoth tables are using the Tags behavior |
# |
Jun 29th 2021, 11:33 |
conehead |
Hmm i just tried upgrading to Cake 4.2 and suddenly I get with my Tags plugin: "The existing `Tags` association on `Tagged` is incompatible with the `Tags` association on...`" This happens when I try to find an entity ```$this->Users->Books->find()->contain(['Tags'])->first(); // this does not work and I get the error TableRegistry::getTableLocator()->get('Books')->contain(['Tags'])->first(); // this does work``` |
# |
Jun 29th 2021, 11:14 |
paolo.bragagni |
ok thanks you are great |
# |
Jun 29th 2021, 11:11 |
kevin.pfeifer |
as in the index.twig |
# |
Jun 29th 2021, 11:11 |
kevin.pfeifer |
bellow you have basically the same foreach but just with the BelongsToMany https://github.com/cakephp/bake/blob/2.5.1/templates/bake/element/form.twig#L64 |
# |
Jun 29th 2021, 11:09 |
kevin.pfeifer |
```{%- if fieldData.null %}``` just checks if the given field can be empty/null or not |
# |
Jun 29th 2021, 11:09 |
ndm |
That check has nothing to do with associations, but whether the field is nullable |
# |
Jun 29th 2021, 11:07 |
paolo.bragagni |
to desume that field is associated to some other table |
# |
Jun 29th 2021, 11:07 |
paolo.bragagni |
{%- set fieldData = Bake.columnData(field, schema) %} {%- if fieldData.null %} |
# |
Jun 29th 2021, 11:07 |
paolo.bragagni |
it checks |
# |
Jun 29th 2021, 11:06 |
paolo.bragagni |
in form.twig the cicle is quite different |
# |
Jun 29th 2021, 11:04 |
paolo.bragagni |
ok more or less I've understand BUT |
# |
Jun 29th 2021, 11:02 |
kevin.pfeifer |
https://github.com/cakephp/bake/blob/2.5.1/templates/bake/Template/index.twig#L43 |
# |
Jun 29th 2021, 11:02 |
kevin.pfeifer |
well the details variable is part of the foreach a few lines above |
# |
Jun 29th 2021, 11:00 |
paolo.bragagni |
uuuu. but I'd like to know where it set details.displayField |
# |
Jun 29th 2021, 10:58 |
paolo.bragagni |
(I'm trying @ndm) :( |
# |
Jun 29th 2021, 10:52 |
ndm |
Check what the built-in templates are doing: https://github.com/cakephp/bake/blob/2.5.1/templates/bake/Template/index.twig#L46 |
# |
Jun 29th 2021, 10:45 |
paolo.bragagni |
but how to get the name of the displayfield of associated model? |
# |
Jun 29th 2021, 10:45 |
paolo.bragagni |
if I set {% set singFieldCapitalize=field[:-3]|capitalize %} I can get the name of associated Model |
# |
Jun 29th 2021, 10:38 |
paolo.bragagni |
so inside the {%- if fieldData.null %} I get the field that are associated (someone please tell me why) |
# |
Jun 29th 2021, 10:37 |
paolo.bragagni |
if form.twig I'd like to get the displayField of the fields of associated tables |
# |
Jun 29th 2021, 10:32 |
goranbloncar |
Hey guys! I am using cake4php and I am trying to connect and query data from aws redshift. So I succeed to query data with connectionManager from controller with raw sql. So my question is can I query data with query builder and how can I set default connection to model ( I set defaultConnectionName method) but I am getting: *cannot cast type regclass to character varying* |
# |
Jun 29th 2021, 10:04 |
paolo.bragagni |
when I bake a view it uses the TemplateCommand.php and I can use some variables that I can desume from the code |
# |
Jun 29th 2021, 09:42 |
info315 |
@paolo.bragagni inside of `public function templateData` |
# |
Jun 29th 2021, 09:39 |
paolo.bragagni |
(where are the variables that cake uses ?) |
# |
Jun 29th 2021, 09:38 |
paolo.bragagni |
@admad *twig.symfony.com* this one? |
# |
Jun 29th 2021, 08:28 |
erwane |
Deleting cookie is not the solution |
# |
Jun 29th 2021, 08:27 |
erwane |
There is my solution : // UsersController::securityForm ```if ($this->Users->save($user)) { $this->Flash->success(__('Mot de passe enregistré'), ['key' => 'form']); $cookies = $this->request->getCookieCollection(); if ($cookies->has('remember_me')) { $hasher = new DefaultPasswordHasher(); $cookie = $cookies->get('remember_me') ->withValue(json_encode([ $user->email, |
# |
Jun 29th 2021, 08:27 |
slackebot |
$hasher->hash($user->email . $user->password), ])); $this->setResponse($this->response->withCookie($cookie)); } return $this->redirect($this->request->getParam('here')); }``` |
# |
Jun 29th 2021, 08:14 |
admad |
@paolo.bragagni by reading the twig docs |
# |
Jun 29th 2021, 08:13 |
admad |
@erwane then just delete the cookie |
# |
Jun 29th 2021, 08:06 |
erwane |
@admad i tried this. The user is not in login form at this moment. They are on the security form. One possibilyt is to force logout user. |
# |
Jun 29th 2021, 08:04 |
paolo.bragagni |
@admad please tell me more. how to lean more? |
# |
Jun 29th 2021, 08:03 |
admad |
@info315 he's talking about bake templates, bake does use twig by default :) |
# |
Jun 29th 2021, 08:02 |
admad |
err @erwane |
# |
Jun 29th 2021, 08:02 |
admad |
@ragnarog_online AuthenticationComponent->setIdentity() |
# |
Jun 29th 2021, 08:01 |
info315 |
@paolo.bragagni No, its not |
# |
Jun 29th 2021, 08:01 |
info315 |
@erwane Yes, try to extend the CookieAuthenticator class or just copyandpaste the cookie logic to make protected functions public |
# |
Jun 29th 2021, 07:59 |
erwane |
not on new login. When user password change |
# |
Jun 29th 2021, 07:58 |
paolo.bragagni |
in cake 4 seems that it use twig by default |
# |
Jun 29th 2021, 07:57 |
info315 |
So you only want to renew the cookie on a new login? |
# |
Jun 29th 2021, 07:56 |
erwane |
I did. All this methods are protected. I try the `persistIdentity` but it need checkbox (or fake one) and be on particular login page. I'm trying to fill it manually |
# |
Jun 29th 2021, 07:54 |
info315 |
@erwane You can checkout the CookieAuthenticator: https://github.com/cakephp/authentication/blob/master/src/Authenticator/CookieAuthenticator.php#L135-L136 |
# |
Jun 29th 2021, 07:48 |
info315 |
@paolo.bragagni CakePHP is not using Twig Templates by default. If you want to know more about Twig check out the docs: https://twig.symfony.com/doc/3.x/ |
# |
Jun 29th 2021, 07:45 |
paolo.bragagni |
how to learn twig templating? Trying to get the displayField of associated model but I cant find the way |
# |
Jun 29th 2021, 07:39 |
erwane |
Hi. Someone have a doc or code for `Cakephp/Authentication` when the user change his/her password and need to renew the `remember_me` cookie value ? |
# |
Jun 29th 2021, 07:32 |
conehead |
>vendor\bin\phpcs -i The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz, Zend, CakePHP, SlevomatCodingStandard and CakePHP Seems to be installed correctly |
# |
Jun 29th 2021, 07:31 |
conehead |
Anyone has seen this error before? Trying to use the CakePHP sniffer: phpcs: ERROR: Referenced sniff "SlevomatCodingStandard.Arrays.TrailingArrayComma" does not exist |
# |
Jun 29th 2021, 07:21 |
dereuromark |
Nmnd: IdeHelper will help u with db columns added. |
# |
Jun 29th 2021, 07:02 |
paolo.bragagni |
how to debug twig variable in cake4 ? |
# |
Jun 29th 2021, 05:32 |
info315 |
Thanks for your feedback, nvm that there is an AssetCompress Plugin |
# |
Jun 28th 2021, 23:08 |
greg138 |
Also, auto-complete in the IDE will let you do `$review->p[ENTER]` instead of `$review->review_p[ENTER]` |
# |
Jun 28th 2021, 23:07 |
greg138 |
I find `$review->published` just fine to read, much better than `$review->review_published` |
# |
Jun 28th 2021, 22:16 |
kevin.pfeifer |
there is a mail tab in the debug kit https://book.cakephp.org/debugkit/3/en/index.html#using-the-mail-panel But as said - the HTML renderer in email clients is worse than you’d expect |
# |
Jun 28th 2021, 22:09 |
kevin.pfeifer |
send it to your own e-mail address and check it in as many email clients as possible ^^ especially HTML mails can be quite difficult to develop so they appear the same in as many different email clients as possible. Thats why there are email template frameworks like MJML |
# |
Jun 28th 2021, 22:06 |
tyler.adam.lazenby |
what is the best way to preview an email that is HTML formatted? |
# |
Jun 28th 2021, 20:56 |
japerlman |
Is there a way to have a query do an OR across a relation? I want to have one search box that searches first_name, last_name, and address and when I try to include address I get SQL errors I'm not sure how to include ro OR on the contain I can't find an example of an OR on a contain ``` $query = $this->People->find(); $query ->where([ 'OR' => [['first_name ILIKE' => '%'.$search.'%'], ['last_name ILIKE' => |
# |
Jun 28th 2021, 20:56 |
slackebot |
'%'.$search.'%']] ]) ->contain(['Addresses']) ->select(['id', 'first_name','last_name']);``` |
# |
Jun 28th 2021, 17:29 |
admad |
Ping to discord |
# |
Jun 28th 2021, 15:35 |
umer936 |
Sweet. I'll let y'all know what I end up going with |
# |
Jun 28th 2021, 15:35 |
umer936 |
@info315 oh I'll check that out too |
# |
Jun 28th 2021, 15:35 |
kevin.pfeifer |
then I would guess the asset-mix plugin is what you need because (as far as I know) the laravel-mix plugin is the easiest way to get started with webpack and therefore have features like tree shaking |
# |
Jun 28th 2021, 15:34 |
umer936 |
Hmm. AssetMix might be a little what I'm looking for... Haha all this Js dependancy stuff got so complicated so fast ,:). But one of the things I would like to use is Tree Shaking so the way I was doing wasn't enough |
# |
Jun 28th 2021, 15:33 |
slackebot |
<https://github.com/it-novum/openITCOCKPIT/blob/5955b1152f1eec021f7e72298e9a9a86692752e0/src/Command/CompressCommand.php#L200%7Ccake shell which copy only the required files>. Still a hack but works not to bad. |
# |
Jun 28th 2021, 15:33 |
info315 |
@umer936 I had a similar issue and had to build something for on my own. I had to move the node_modules folder out of the webroot because it is full of bash scripts and example files. I added a <https://github.com/it-novum/openITCOCKPIT/blob/development/src/itnovum/openITCOCKPIT/Core/AngularJS/AngularAssets.php#L36%7Clist> of all loaded npm files to my code and created a |
# |
Jun 28th 2021, 15:28 |
kevin.pfeifer |
or you use the asset-mix plugin https://github.com/ishanvyas22/asset-mix which is based on laravel-mix |
# |
Jun 28th 2021, 15:26 |
kevin.pfeifer |
well you can still use npm normally like in any other project I still love gulp and use it to generate CSS and JS from my source files and downloaded modules but as far as I know there is no out of the box npm/JS bundler in cakephp present. Maybe you can find a plugin Maybe you can copy some things from this vuejs single page application template https://github.com/ishanvyas22/cakephpvue-spa |
# |
Jun 28th 2021, 15:23 |
umer936 |
Hi, what's the way to have npm (or yarn) as a package manager for front-end stuff (JS)? Laravel has mix-ins to handle this. After trying quite a few things, I've come to using the "foxy" composer plugin (to allow composer to run npm commands) and putting my node_modules folder in /webroot/js so I can access them in my templates. This still feels a little like a hack. |
# |
Jun 28th 2021, 15:20 |
info315 |
Oh i see you are still using freenode - the Freenode stuff delete my user account and hijack our community channel (together with more than 700 other channels) |
# |
Jun 28th 2021, 15:18 |
dereuromark |
@info315 https://api.slack.com/reference/surfaces/formatting#linking-urls |
# |
Jun 28th 2021, 15:18 |
admad |
But the bridge seems down :( |
# |
Jun 28th 2021, 15:17 |
kevin.pfeifer |
https://discord.gg/k4trEMPebj |
# |
Jun 28th 2021, 15:16 |
info315 |
@admad Really? Can you send me an invite link please? @dereuromark Good to know |
# |
Jun 28th 2021, 15:14 |
admad |
We are on Discord too :) |
# |
Jun 28th 2021, 15:14 |
dereuromark |
@info315 Slack uses a different markup ;) <link|url> etc |
# |
Jun 28th 2021, 15:13 |
info315 |
Fun fact, Slack isn't as Markdown friendly as I expected^^ |
# |
Jun 28th 2021, 15:13 |
ankitgsolanki |
@admad Ok |
# |
Jun 28th 2021, 15:12 |
admad |
@ankitgsolanki ignore my comments about scopes :) |
# |
Jun 28th 2021, 15:11 |
admad |
Sorry I had a dumb moment, it's a config for logger not cache. |
# |
Jun 28th 2021, 14:54 |
info315 |
@admad What is the `scopes` option? Its unknown to the [docs](https://book.cakephp.org/4/en/core-libraries/caching.html) and the [code](https://github.com/cakephp/cakephp/blob/master/src/Cache/Engine/RedisEngine.php) |
# |
Jun 28th 2021, 14:51 |
ankitgsolanki |
@admad Ok |
# |
Jun 28th 2021, 14:50 |
admad |
@ankitgsolanki err... needs to be `false` not `null` |
# |
Jun 28th 2021, 14:49 |
ankitgsolanki |
@admad No. Let me try with add this config |
# |
Jun 28th 2021, 14:48 |
admad |
@ankitgsolanki Have you set `'scopes' => null` for the redis config? |
# |
Jun 28th 2021, 14:44 |
info315 |
Me too. Check the Redis Metrics and your Code - something is firing hundreds of requests or stores large files to redis i guess |
# |
Jun 28th 2021, 14:40 |
admad |
If it's not the default cache and it's not used for the current request then Cake wouldn't even connect to it, so don't see how it could cause any slowdown. |
# |
Jun 28th 2021, 14:38 |
ankitgsolanki |
I have defined new cache for redis server in app.php and default cache is file cache |
# |
Jun 28th 2021, 14:36 |
info315 |
Have you set your default cache to redis? Or did you defined a new cache in app.php just for the particular data that has to be stored to redis? |
# |
Jun 28th 2021, 14:32 |
ankitgsolanki |
@info315 At this post request I am not sending any request to Redis server. |
# |
Jun 28th 2021, 14:31 |
info315 |
@ankitgsolanki How many requests do you send to the redis server per POST request? |
# |
Jun 28th 2021, 14:30 |
tomrwaller |
Thanks again @ndm - your tip pointed me in the right direction and I ended up looking at the BootstrapUI plugin by FriendsOfCake which has shown me how to avoid using dumb templates! |