# |
May 25th 2021, 20:40 |
etibor |
is there a way to display the not permitted character in error message? |
# |
May 25th 2021, 20:40 |
etibor |
okey i actually found, by var_dump the getErrors() |
# |
May 25th 2021, 20:02 |
rightscoreanalysis |
is it hacky to be reading session data in a model? |
# |
May 25th 2021, 19:41 |
etibor |
how the error message will return ? |
# |
May 25th 2021, 19:41 |
etibor |
like this $this->Model->validate('name') |
# |
May 25th 2021, 19:41 |
etibor |
i think its enough to validate a single field, i dont have a lot just 3 |
# |
May 25th 2021, 19:03 |
kevin.pfeifer |
but that doesn’t have anything to do with cakephp so :man-shrugging: |
# |
May 25th 2021, 19:03 |
kevin.pfeifer |
well If you need client side Form Validation I can recommend Parsley |
# |
May 25th 2021, 18:53 |
etibor |
unfortunatly(i have multiple fields for the same model's field and displayed with jquery as the user choose different values from select input) i could not use the same model fields on the form |
# |
May 25th 2021, 18:44 |
kevin.pfeifer |
per field errors are usually defined via the validator present in the tables `validationDefault($validator)` function And if there is an error it is outputted automatically under the field when you use `$this->Form->control('fieldname');` |
# |
May 25th 2021, 18:35 |
etibor |
i created a complex form, with complex funcation calling when i have an error on the form its not possible anymore to show the form input error in the right place i only have the Model->getErrors() but its return an array how can i display the error messeges from there? |
# |
May 25th 2021, 18:33 |
etibor |
hello everyone |
# |
May 25th 2021, 16:41 |
admad |
It's likely someone might maintain is as a separate plugin :). |
# |
May 25th 2021, 16:40 |
admad |
Unless stated otherwise always assume that a deprecated feature will be removed in next major. |
# |
May 25th 2021, 15:14 |
neon1024 |
Yes, good spot, thanks |
# |
May 25th 2021, 14:53 |
ndm |
The migration guide says that it will be removed in 5.x, but that's the only place that mentions a version AFAICT. https://book.cakephp.org/4/en/appendices/4-0-migration-guide.html#component |
# |
May 25th 2021, 14:46 |
neon1024 |
I assumed 5.x as it’s deprecated now in 4.x |
# |
May 25th 2021, 14:46 |
neon1024 |
Anyone know when AuthComponent is being removed? I don’t see it on the 5.x roadmap |
# |
May 25th 2021, 10:57 |
neon1024 |
Convoluted but okay |
# |
May 25th 2021, 10:56 |
neon1024 |
ArrayAccess |
# |
May 25th 2021, 10:56 |
neon1024 |
Ah, EntityInterface implements |
# |
May 25th 2021, 10:56 |
neon1024 |
Or is an Entity \ArrayAccess? |
# |
May 25th 2021, 10:55 |
neon1024 |
Have I misconfigured something? I am using the `Authentication.Session` Authenticator, with the Form one for login, and an `auth` finder in my `UsersTable` |
# |
May 25th 2021, 10:54 |
neon1024 |
How do I get a consistent type return from Authentication? I am trying `$this->Authentication->getIdentity()->getOriginalData()` (the component), and the method return type is marked as `@return \ArrayAccess|array` but when I dump it in my controller it’s `App\Model\Entity\User Object` |
# |
May 25th 2021, 10:50 |
ndm |
https://stackoverflow.com/questions/62713730/why-is-the-callback-identifier-not-being-invoked/62718515#62718515 |
# |
May 25th 2021, 10:36 |
kushan |
thanks, may I ask if there is a link to an example please? |
# |
May 25th 2021, 10:34 |
ndm |
Certainly possible |
# |
May 25th 2021, 10:33 |
kushan |
is it possible to have an Authenticator class in my codebase (src/) that extends an existing core Authenticator? I tried adding it to src/Authenticator but it didn't work. |
# |
May 25th 2021, 10:10 |
ndm |
Then the answer is no, the matching process will always sort the routes according to their template, in descending regular order. If you're using 4.2.2+, you can use `bin/cake routes` to check in what order they will be matched (top first). |
# |
May 25th 2021, 10:04 |
rudy1976s |
yes |
# |
May 25th 2021, 10:02 |
ndm |
@rudy1976s What does "order" mean to you? The order in which they are being tested when trying to match a URL? |
# |
May 25th 2021, 08:36 |
rudy1976s |
Good morning , is there a way to set up an order for routes? |
# |
May 24th 2021, 23:37 |
rightscoreanalysis |
ok I might just need to change the model file then, no big deal |
# |
May 24th 2021, 23:36 |
rightscoreanalysis |
cak2 btw ^ |
# |
May 24th 2021, 23:32 |
ndm |
I don't really remember anymore how the class registry works... but I think it required unique aliases just like 3.x+ does, ie there can be only one `Order`, and the first one initialized wins. |
# |
May 24th 2021, 23:24 |
rightscoreanalysis |
Ok thanks as an aside, My plugin has an Order model, I need to load my main Oder model though, when I do ClassRegistry::init('Order') cake is loading the plugin version not the main. How can i load the main? |
# |
May 24th 2021, 23:23 |
ndm |
I'd assume that your webhook is a separate request, and therefore a separate connection. Note that internally the id is populated using the last insert ID too. |
# |
May 24th 2021, 23:21 |
rightscoreanalysis |
a webhook is bein gprocessed for another order, so the last InserID might not be what you expect it to be |
# |
May 24th 2021, 23:21 |
rightscoreanalysis |
I mean say a customer updated an Order with a purchase using the frontend |
# |
May 24th 2021, 23:18 |
ndm |
Probably depends on your DBMS and on what you mean by "_resources_". In MySQL for example the last insert ID is per-connection. |
# |
May 24th 2021, 22:40 |
rightscoreanalysis |
want to make sure I am correct in what I am saying, better to use $this->Model->id ? |
# |
May 24th 2021, 22:40 |
rightscoreanalysis |
trying to explain that it is risky and shouldn't be relied on to find *your* last insert id |
# |
May 24th 2021, 22:39 |
rightscoreanalysis |
lastInsertId is the last insert id to the db from any resources is that correct? |
# |
May 24th 2021, 19:34 |
david |
thank you @kevin.pfeifer |
# |
May 24th 2021, 19:33 |
kevin.pfeifer |
but haven't dealt with routes that deep till now |
# |
May 24th 2021, 19:32 |
kevin.pfeifer |
otherwise i would guess you would need to create a custom route class to parse the URL https://book.cakephp.org/4/en/development/routing.html#custom-route-classes and then redirect on that match to whatever you need https://book.cakephp.org/4/en/development/routing.html#redirect-routing |
# |
May 24th 2021, 19:31 |
david |
it was only a try |
# |
May 24th 2021, 19:31 |
david |
yes @kevin.pfeifer, is the way i'm doing right now |
# |
May 24th 2021, 19:30 |
kevin.pfeifer |
i think you are faster when you do that via a .htaccess rewrite rule |
# |
May 24th 2021, 19:19 |
david |
I can't figure how to use wildcards in redirections, or if it is possible |
# |
May 24th 2021, 19:18 |
david |
is there any smart way to redirect using routes all urls containing a word? Something like "redirect /%wp% to /404" |
# |
May 24th 2021, 19:16 |
david |
Hello :) |
# |
May 24th 2021, 13:43 |
michal_kotus |
Hi, @khalil, I am not sure, Mercury is disabled, gonna check. Thank you |
# |
May 24th 2021, 13:40 |
khalil |
And when I remove [] from the field it sends one value instead of multiple |
# |
May 24th 2021, 13:23 |
khalil |
@michal_kotus You have an SMTP server installed on your machine? |
# |
May 24th 2021, 13:22 |
michal_kotus |
Hello, I am trying to use https://book.cakephp.org/4/en/core-libraries/email.html#creating-reusable-emails. I created new project, baked all Users, added Authentication plugin, added login page, added code examples from cookbook (link above), added template `templates/email/text/welcome_mail.php` . I do use XAMPP, so in `php.ini` I put `SMTP = localhost` and `smtp_port = 25`, but I get: `Could not send email: unknown`. |
# |
May 24th 2021, 13:22 |
slackebot |
What do I miss? |
# |
May 24th 2021, 13:20 |
khalil |
@admad did both of those and the issue remains |
# |
May 24th 2021, 13:10 |
etibor |
so i must say clerk's users controller means admin's controller |
# |
May 24th 2021, 13:06 |
etibor |
but does not helped |
# |
May 24th 2021, 13:06 |
etibor |
i tried like this : $routes->connect('/clerk', ['prefix'=>'admin']); |
# |
May 24th 2021, 13:05 |
etibor |
how can i redirect my clerk prefix to admin prefix ? |
# |
May 24th 2021, 13:04 |
etibor |
hello all |
# |
May 24th 2021, 10:58 |
khalil |
Ah ok perfect, thanks! |
# |
May 24th 2021, 10:58 |
admad |
Also you need multiple => true |
# |
May 24th 2021, 10:56 |
admad |
The fieldname arg should be just `availability` without the []. |
# |
May 24th 2021, 10:42 |
khalil |
Mind you I have no validation set on this field |
# |
May 24th 2021, 10:32 |
khalil |
But I want the field to post a blank array in order to remove the saved ones, what am I doing wrong? |
# |
May 24th 2021, 10:31 |
khalil |
It's because when nothing is selected, the field is not being posted |
# |
May 24th 2021, 10:31 |
khalil |
When an option is selected in the select box, everything works properly, but when I don't select anything, I get an error: *Missing field 'availability' in POST data* |
# |
May 24th 2021, 10:30 |
khalil |
Hello! I'm facing an issue with the security component (most probably), I have a form that has a ```<?= $this->Form->select('availability[]', $countries, ["multiple", "value" => []] ?>``` |
# |
May 24th 2021, 10:19 |
rudy1976s |
@kevin.pfeifer thank you ! |
# |
May 24th 2021, 10:19 |
rudy1976s |
@steinkel thank you ! |
# |
May 24th 2021, 10:19 |
steinkel |
@rudy1976s you could define the transport this way from nginx `fastcgi_param EMAIL_TRANSPORT_DEFAULT_URL smtp://user:password@smtpserver.com:25?tls=nullandclient=nullandtimeout=30;` |
# |
May 24th 2021, 09:47 |
kevin.pfeifer |
@rudy1976s i am not aware, that you can define a complete e-mail transport via .env variables. But you can of course just extend your .env variable by all the needed parameters and read them in your app_local.php or wherever you define your transport configs |
# |
May 24th 2021, 09:44 |
michal_kotus |
Thanks!! |
# |
May 24th 2021, 09:32 |
kevin.pfeifer |
```use Cake\Mailer\MailerAwareTrait;``` is just 1 part you need to add to your controller. You also need to add ```use MailerAwareTrait;``` bellow the class definition, so in total like ```use Cake\Mailer\MailerAwareTrait; class UsersController extends AppController { use MailerAwareTrait;``` |
# |
May 24th 2021, 09:25 |
michal_kotus |
Hello, I am learning https://book.cakephp.org/4/en/core-libraries/email.html#creating-reusable-emails. But in PHPStorm I get warning `Method 'getMailer' not found in UsersController` and in browser I get `Call to undefined method App\Controller\UsersController::getMailer()`. I put use `Cake\Mailer\MailerAwareTrait;` into UsersController, so why it do not want to find getMailer method? Thanks for an answer |
# |
May 24th 2021, 08:51 |
rudy1976s |
I would like to configure mailer using env file : what is the correct syntax to build the url ? is there somewhere an example ? thank you !!!! |
# |
May 24th 2021, 08:49 |
rudy1976s |
good morning !!!! |
# |
May 24th 2021, 08:04 |
khalil |
Thanks @dereuromark! |
# |
May 24th 2021, 07:44 |
dereuromark |
And yes, it might be stored as jaon, but that is not sth visible from normal usage |
# |
May 24th 2021, 07:44 |
dereuromark |
The core natively Supports array. Json is sth only Extertal api represenstation needs. Internally, using array suffices imo. |
# |
May 23rd 2021, 22:50 |
kevin.pfeifer |
https://github.com/liqueurdetoile/cakephp-orm-json But I would rather split that json appart and save the individual fields either in the given data structure (=seperate tables) or in a generic key- and value-columb table rather than saving the JSON directly |
# |
May 23rd 2021, 22:17 |
khalil |
is MySQL JSON column type supported in cakephp? I can't find anything about it in the docs, unless I'm missing something |
# |
May 23rd 2021, 22:16 |
khalil |
Another quick question |
# |
May 23rd 2021, 22:16 |
khalil |
Hey guys |
# |
May 22nd 2021, 20:00 |
Martin` |
hi |
# |
May 22nd 2021, 18:18 |
etibor |
Hello everyone |
# |
May 21st 2021, 15:49 |
ndm |
@neon1024 Identifiers are not tied to a specific "backend", the identity could stem from anywhere, not necessarily a row in a database. If you want something consistent, consider `AuthenticationComponent::getIdentity()`, which will always give you something that implements `\Authentication\IdentityInterface`. |
# |
May 21st 2021, 15:39 |
caseyw |
@ndm that's what I'm looking into right now. Thanks for that. |
# |
May 21st 2021, 15:38 |
ndm |
@caseyw Neither attributes nor parameters can be configured for a test request, so it wouldn't make a difference. If you're mocking the thing that sets the attribute, then it's maybe possible to set the attribute from your mock config. |
# |
May 21st 2021, 15:31 |
neon1024 |
PHP Stan gets angry if you try and `instanceof \ArrayObject` |
# |
May 21st 2021, 15:30 |
slackebot |
<neon1024> |
# |
May 21st 2021, 15:30 |
neon1024 |
I’ve had array, Entity and ArrayObject |
# |
May 21st 2021, 15:29 |
neon1024 |
> TypeError: Argument 1 passed to Cake\ORM\Table::save() must implement interface Cake\Datasource\EntityInterface, instance of ArrayObject given, called in /var/www/html/src/Model/Table/UsersTable.php on line 259 |
# |
May 21st 2021, 15:29 |
neon1024 |
Why does Identity return so many types? |
# |
May 21st 2021, 15:25 |
kevin.pfeifer |
I just checked the doc for CakePHP 2 https://book.cakephp.org/2/en/core-utility-libraries/security.html As stated there `cipher() uses a *weak* XOR cipher and should *not* be used. It is only included for backwards compatibility.` Dont know if you can/should get that working with newer versions. I would recommend you to start planning a cakephp upgrade in general since cakephp 2 has an EOL of 15th June 2021 |
# |
May 21st 2021, 15:25 |
slackebot |
https://github.com/cakephp/cakephp/releases/tag/2.10.24 |
# |
May 21st 2021, 14:54 |
rajesh |
do any one have suggestion? how swiftly we can migrate from 5.6 to 7.3 - without deleting old cookies - Thanks |