# |
Dec 6th 2019, 16:42 |
neon1024 |
Yeah, seems it’s all setup but `errors()` doesn’t actually run like it says that it does :thinking_face: |
# |
Dec 6th 2019, 16:42 |
ndm |
It should work... you don't need a custom validator instance though, you can use `getValidator()`, and you need to make sure that pass whether it's an create or update to the `errors()` method. |
# |
Dec 6th 2019, 16:39 |
neon1024 |
Shame really, that really felt like something that could be achieved with just a Validator |
# |
Dec 6th 2019, 16:39 |
neon1024 |
I guess it doesn’t work and I’ll have to use an integration test |
# |
Dec 6th 2019, 16:37 |
neon1024 |
Although I am assuming my validation will throw errors! |
# |
Dec 6th 2019, 16:36 |
neon1024 |
When checking `$validator->field('id')` for example, you see the rules in the ValidationSet. Perhaps the docblock is wrong and `errors()` doesn’t actually do what it says |
# |
Dec 6th 2019, 16:35 |
neon1024 |
As my assumption is that the app table class just decorates an instance with the rules |
# |
Dec 6th 2019, 16:34 |
slackebot2 |
<neon1024> |
# |
Dec 6th 2019, 16:34 |
neon1024 |
Yeah, it is a table instance |
# |
Dec 6th 2019, 16:33 |
neon1024 |
Maybe, let me check, although it’s a baked test case |
# |
Dec 6th 2019, 16:33 |
ndm |
Maybe `$this->ProviderPortalSaleDataTable` isn't what you expect it to be. |
# |
Dec 6th 2019, 16:30 |
neon1024 |
At least when you query the field from the validator |
# |
Dec 6th 2019, 16:30 |
neon1024 |
protected $_rules => array(0) { } |
# |
Dec 6th 2019, 16:30 |
neon1024 |
Seems it’s not adding any rules? |
# |
Dec 6th 2019, 16:26 |
neon1024 |
That’s the wrong supposition as it’s default is `Cake\Validation\Validation` |
# |
Dec 6th 2019, 16:25 |
ricksaccous |
how can i buy a portal? |
# |
Dec 6th 2019, 16:25 |
neon1024 |
Seems using a new instance means it has no provider :thinking_face: |
# |
Dec 6th 2019, 16:23 |
neon1024 |
I’,m not even sure where to start looking for this type of test in the core tests |
# |
Dec 6th 2019, 16:23 |
neon1024 |
Although you’re probably right as this approach doesn’t seem to work, as the method always returns an empty array fore me |
# |
Dec 6th 2019, 16:23 |
neon1024 |
But that’s an integration test right? I just want to test validation, I assume that patchEntity works |
# |
Dec 6th 2019, 16:21 |
ndm |
I usually test implicitly by creating/patching/saving entities. |
# |
Dec 6th 2019, 16:19 |
ndm |
`$validator = $this->ProviderPortalSaleDataTable->getValidator('default');` |
# |
Dec 6th 2019, 16:13 |
slackebot2 |
<neon1024> |
# |
Dec 6th 2019, 16:13 |
neon1024 |
When I want to test my validation, I presume that it’s as simple as |
# |
Dec 6th 2019, 15:47 |
ricksaccous |
since changing the pk of a table is not possible without recreating it i don't believe |
# |
Dec 6th 2019, 15:46 |
ricksaccous |
if you already have a table there though you might as well destroy and recreate it |
# |
Dec 6th 2019, 15:46 |
ricksaccous |
yeah it is |
# |
Dec 6th 2019, 15:35 |
devito |
hello all, is it possable to add a composite key using a migration? i see the add index function accepts an array of id’s but i am assuming it will add the same type of index per column such as unique |
# |
Dec 6th 2019, 15:29 |
daniel.upshaw |
Has anyone ever trying using the concept of layouts, with View Cells? Like extending a base Cell Template |
# |
Dec 6th 2019, 14:57 |
ricksaccous |
at least that's where i tend to put that logic |
# |
Dec 6th 2019, 14:57 |
ricksaccous |
and setting it when you get the entity |
# |
Dec 6th 2019, 14:57 |
ricksaccous |
the only other pain is handling beforeMarshal |
# |
Dec 6th 2019, 14:57 |
ricksaccous |
i've recently just done that |
# |
Dec 6th 2019, 14:56 |
ricksaccous |
@challgren you can use that input mask jquery plugin |
# |
Dec 6th 2019, 14:13 |
admad |
> Its the dropdown for the dates throws them off they prefer to enter YYYY-mm-dd for example @challgren then can do so do with the html5 datetime inputs, which are default in cake 4 :slightly_smiling_face: |
# |
Dec 6th 2019, 13:00 |
neon1024 |
Oh I see |
# |
Dec 6th 2019, 13:00 |
challgren |
Its the dropdown for the dates throws them off they prefer to enter YYYY-mm-dd for example |
# |
Dec 6th 2019, 12:59 |
neon1024 |
I still think you can pass `'tabindex' => {n}` as a option |
# |
Dec 6th 2019, 12:58 |
challgren |
That is annoying honestly. My users are all old school dos guys and just like to tab through everything |
# |
Dec 6th 2019, 12:48 |
neon1024 |
Like the single date input which cropped up the other day |
# |
Dec 6th 2019, 12:47 |
neon1024 |
Perhaps there could be a plugin which contains a number of frequently requested form widgets already built |