# |
Mar 25th 2019, 17:40 |
ricksaccous |
i think you just need a lowercase y |
# |
Mar 25th 2019, 17:40 |
ricksaccous |
https://api.cakephp.org/3.7/class-Cake.Validation.Validator.html#_date |
# |
Mar 25th 2019, 17:39 |
ricksaccous |
you'll see that the date validator is the one triggered |
# |
Mar 25th 2019, 17:39 |
ricksaccous |
so i think the answer is pretty simple |
# |
Mar 25th 2019, 17:37 |
this.impetus |
done; added a new file to the gist, "Debug Output" |
# |
Mar 25th 2019, 17:36 |
ricksaccous |
add the resulting debug information to the gist if you want |
# |
Mar 25th 2019, 17:36 |
this.impetus |
ah. brilliant. sec. |
# |
Mar 25th 2019, 17:35 |
ricksaccous |
and that will give more information to proceed |
# |
Mar 25th 2019, 17:35 |
ricksaccous |
you should see which validation rule triggered for the year to be invalid |
# |
Mar 25th 2019, 17:35 |
ricksaccous |
exit; |
# |
Mar 25th 2019, 17:35 |
ricksaccous |
after this line debug($assignment); |
# |
Mar 25th 2019, 17:35 |
ricksaccous |
@this.impetus https://gist.github.com/jmwmulle/497103a7510ca52cb3d7f18b578a80ea#file-controller-L64 |
# |
Mar 25th 2019, 17:32 |
this.impetus |
... I am terribly sorry; assuming you're indicating a specific means of debugging, I don't know how to do that. |
# |
Mar 25th 2019, 17:31 |
ricksaccous |
have you tried debugging the entity after patching it? |
# |
Mar 25th 2019, 17:31 |
this.impetus |
yeah, ```<?=$this->Form->control('academic_year', ['type'=>'year', 'minYear'=>1950, 'maxYear'=>date('Y')]);?>``` creates a dropdown select |
# |
Mar 25th 2019, 17:31 |
ricksaccous |
@this.impetus it might be helpful to see what error is triggering, is it the integer rule that causes it to trigger? |
# |
Mar 25th 2019, 17:30 |
ricksaccous |
eh it's prob with the type year stuff |
# |
Mar 25th 2019, 17:29 |
ricksaccous |
is it working like a dropdown? |
# |
Mar 25th 2019, 17:29 |
ricksaccous |
i don't see a dropdown? |
# |
Mar 25th 2019, 17:15 |
this.impetus |
https://gist.github.com/jmwmulle/497103a7510ca52cb3d7f18b578a80ea |
# |
Mar 25th 2019, 17:13 |
this.impetus |
on it. thanks for pateince |
# |
Mar 25th 2019, 17:12 |
ricksaccous |
https://gist.github.com/ |
# |
Mar 25th 2019, 17:12 |
ricksaccous |
gist up your model, controller, and view |
# |
Mar 25th 2019, 17:12 |
this.impetus |
So the database expects a year, the form records a year, my validator expects a year... but I am getting "The provided value is invalid" on my front end. |
# |
Mar 25th 2019, 17:11 |
this.impetus |
hrmm. upon closer inspection I think I have the form set up correctly in any case: <?=$this->Form->control('academic_year', ['type'=>'year', 'minYear'=>1950, 'maxYear'=>date('Y')]);?> |
# |
Mar 25th 2019, 17:10 |
berarma |
The browser always sends strings. The entity marshaller then converts it to the database field type. |
# |
Mar 25th 2019, 17:08 |
this.impetus |
... and apparently backticks aren't how you indicate code in slack... new to this as well.. thanks for putting up wth me |
# |
Mar 25th 2019, 17:07 |
this.impetus |
I tried changing `$validator ->integer('academic_year',)` to `$validator ->date('academic_year', ['y'])` but this produced the same result |
# |
Mar 25th 2019, 17:06 |
this.impetus |
subsequently, an integer is no longer sent to the controller when a record is created, and the validator is complaining. I am certain there is some dead-simple solution here that I am missing, but I am extremely new to cake3 |
# |
Mar 25th 2019, 17:04 |
this.impetus |
*created a text field |
# |
Mar 25th 2019, 17:04 |
this.impetus |
but the baked forms, because I indicated that the year column should be an integer, created a text. When I manually edited it to create a dropdown menu listing n-years the form broke; now I get validation errors |
# |
Mar 25th 2019, 17:04 |
berarma |
I don't get the question. |
# |
Mar 25th 2019, 17:03 |
this.impetus |
when I baked it, yes |
# |
Mar 25th 2019, 17:03 |
berarma |
@this.impetus, isn't this all done automatically? |
# |
Mar 25th 2019, 16:58 |
this.impetus |
this sides = this sends, sorry |
# |
Mar 25th 2019, 16:58 |
slackebot2 |
for me. Tried changing the @property in the model's Entity file to no avail, also tried writing a custom validator but getting errors that the vars used the cookbook example don't exist. Save me from myself? |
# |
Mar 25th 2019, 16:58 |
this.impetus |
Hi guys, nub question: have a drop-down menu for selecting "year"; alas this sides a string to cake. When I built the database I accidentally set the column to "int(11)" instead of something reasonable and now the entity expects and integer as does the validator. I know how to intercept the data in the controller methods and just convert the year string to an int, but, I presume the there is a way to have the Entity and Table do this |
# |
Mar 25th 2019, 16:34 |
berarma |
Yes, I'll try that. LXC works well alone, although a bit low-level. I've heard good things about Vagrant. |
# |
Mar 25th 2019, 16:31 |
ricksaccous |
@berarma interesting: https://github.com/fgrehm/vagrant-lxc |
# |
Mar 25th 2019, 16:29 |
berarma |
Thanks, team! (@neon1024, @ricksaccous) :P |
# |
Mar 25th 2019, 16:27 |
berarma |
OK. I was using LXC because is very lightweight now thinking on using Vagrant/LXC. |