# |
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 |
slackebot |
$hasher->hash($user->email . $user->password), ])); $this->setResponse($this->response->withCookie($cookie)); } return $this->redirect($this->request->getParam('here')); }``` |
# |
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: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 |