# |
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 |
# |
Jan 4th 2019, 19:13 |
jeremyharris |
I like to explicitly call ->decrypt so it doesn’t accidentally leak sensitive information |
# |
Jan 4th 2019, 19:12 |
jhall |
oh ok that might be the way to go |
# |
Jan 4th 2019, 19:12 |
jeremyharris |
I use a custom EncryptedStringType that does it all at the db type level, which creates an object that has a ->decrypt() method on it |
# |
Jan 4th 2019, 19:11 |
jeremyharris |
probably an accessor |
# |
Jan 4th 2019, 19:11 |
jhall |
I tried afterFind but it does not appear to being called |
# |
Jan 4th 2019, 19:11 |
jhall |
What is the best model callback to use to decrypt some data before I display it in the template? |
# |
Jan 4th 2019, 19:10 |
Bambino |
Thank you! I will start doing this. |
# |
Jan 4th 2019, 19:09 |
dereuromark |
for bake not even that is needed |
# |
Jan 4th 2019, 19:09 |
dereuromark |
first rule of cli: -h (--help) on a command |
# |
Jan 4th 2019, 19:09 |
dereuromark |
bake model? |
# |
Jan 4th 2019, 19:06 |
Bambino |
How can I bake a model? |
# |
Jan 4th 2019, 15:57 |
challgren |
@hippo probably best just to delete the directory and have composer reinstall it. Sounds like your package was modified |
# |
Jan 4th 2019, 13:28 |
hippo |
@challgren it's really strange.. On line 308 in my source it has `if (is_string($event))` .. Doesn't make any sense.. |
# |
Jan 4th 2019, 10:23 |
asdfgh |
yes hippo i am trying thanks |
# |
Jan 4th 2019, 10:22 |
challgren |
https://github.com/cakephp/cakephp/blob/3.7.2/src/Event/EventManager.php#L312 |
# |
Jan 4th 2019, 10:22 |
challgren |
infact that call should be on Line 312 if you are running 3.7.1 |
# |
Jan 4th 2019, 10:21 |
challgren |
It sounds like you have a modified source file because line 308 has not been modified in over 4 years. https://github.com/cakephp/cakephp/blame/eae26792654fece99bb121420e179f0a0efcb2ae/src/Event/EventManager.php#L308 |