# |
Jan 4th 2019, 21:39 |
ricksaccous |
and I tried $this->RelatedModel->validationSomething($validator) |
# |
Jan 4th 2019, 21:38 |
phantomwatson |
Validation rules should run in the same order as the code. |
# |
Jan 4th 2019, 21:38 |
ricksaccous |
SomeMethod* |
# |
Jan 4th 2019, 21:38 |
ricksaccous |
i have validationSomeMethod in Magicians model and validationSomeModel in Tricks model |
# |
Jan 4th 2019, 21:38 |
phantomwatson |
Did you place the child validation rule first? |
# |
Jan 4th 2019, 21:37 |
ricksaccous |
last only affects within that validator i think |
# |
Jan 4th 2019, 21:37 |
ricksaccous |
parent model rules still ran first |
# |
Jan 4th 2019, 21:37 |
phantomwatson |
What were the results? |
# |
Jan 4th 2019, 21:36 |
ricksaccous |
i've tried that |
# |
Jan 4th 2019, 21:35 |
phantomwatson |
You may be able to rig up a validation rule for the Magicians model that validates the `tricks` field and is marked `'last' => true`. That way, the Tricks validation error shows and not any subsequent validation errors on the Magicians model. |
# |
Jan 4th 2019, 21:34 |
ricksaccous |
i'm giong to try something |
# |
Jan 4th 2019, 21:34 |
ricksaccous |
hmmmm |
# |
Jan 4th 2019, 21:33 |
ricksaccous |
that's pretty much it actually, lol |
# |
Jan 4th 2019, 21:33 |
ricksaccous |
because no fields are integers the Magicians has no tricks error displays and not the integer validation on Tricks |
# |
Jan 4th 2019, 21:32 |
ricksaccous |
Tricks has a validation rule on a field where i need it to be an integer |
# |
Jan 4th 2019, 21:32 |
ricksaccous |
Magicians has a validation rule where if there are no Tricks display an error |
# |
Jan 4th 2019, 21:31 |
ricksaccous |
Magicians hasMany Tricks |
# |
Jan 4th 2019, 21:31 |
ricksaccous |
i actually can't because im validating a single Model but I want child data of it to be validated first, for example |
# |
Jan 4th 2019, 21:29 |
phantomwatson |
@ricksaccous You can do that. What's the problem? |
# |
Jan 4th 2019, 21:23 |
ricksaccous |
what if i want to validate one model before another |
# |
Jan 4th 2019, 21:22 |
ricksaccous |
now i've run into another problem |
# |
Jan 4th 2019, 21:14 |
phantomwatson |
And I'm _pretty_ sure the local timezone is UTC-4 or UTC-5 hours, not UTC+1 year. |
# |
Jan 4th 2019, 21:13 |
slackebot |
[timezone] => UTC [fixedNowTime] => ) ``` is converted to ``` December 30, 2019 ``` |
# |
Jan 4th 2019, 21:13 |
phantomwatson |
I'm encountering a weird problem with the TimeHelper in CakePHP 3.6.9 that's resulting in an extra year being added when a date is formatted. The code: ``` pr($date); echo '<br />is converted to<br />'; pr($this->Time ->format( $date, 'MMMM d, YYYY', null, \Cake\Core\Configure::read('localTimezone') ) ); ``` The output: ``` Cake\I18n\FrozenTime Object ( [time] => 2018-12-31T02:39:55+00:00 |
# |
Jan 4th 2019, 20:55 |
ricksaccous |
tbh |
# |
Jan 4th 2019, 20:55 |
ricksaccous |
child is actually just an array of data |
# |
Jan 4th 2019, 20:53 |
ricksaccous |
ugh |
# |
Jan 4th 2019, 20:53 |
ricksaccous |
my use case is weird because the parent entity is represented by a table but child entity is not really |
# |
Jan 4th 2019, 20:52 |
ricksaccous |
under the correct conditions |
# |
Jan 4th 2019, 20:52 |
jeremyharris |
you can maybe use a table rule to do this though |
# |
Jan 4th 2019, 20:52 |
ricksaccous |
I'm opting to just do $this->Form->error('field') under the desired field |
# |
Jan 4th 2019, 20:52 |
jeremyharris |
actually I don’t think they will. validators only validate a flat array, they aren’t aware that the data is an entity or should has “children” |
# |
Jan 4th 2019, 20:50 |
jeremyharris |
you can use nested validators though. they might do the trick |
# |
Jan 4th 2019, 20:50 |
jeremyharris |
or are you asking for the validator to set the error? because it cannot |
# |
Jan 4th 2019, 20:49 |
jeremyharris |
setError on the entity |
# |
Jan 4th 2019, 20:04 |
ricksaccous |
i want to place the error on the first related entity to the parent entity |
# |
Jan 4th 2019, 20:03 |
ricksaccous |
if validation fails on the parent entity |
# |
Jan 4th 2019, 20:03 |
ricksaccous |
on a related entity |
# |
Jan 4th 2019, 20:03 |
ricksaccous |
how do i place an error |
# |
Jan 4th 2019, 19:13 |
jhall |
thanks |
# |
Jan 4th 2019, 19:13 |
jhall |
yeah true |