# |
Mar 25th 2019, 17:52 |
this.impetus |
ok. neat. not one solution but 3 haha. thanks |
# |
Mar 25th 2019, 17:52 |
this.impetus |
oh yes I do |
# |
Mar 25th 2019, 17:52 |
this.impetus |
I don't understand that last one. |
# |
Mar 25th 2019, 17:52 |
ricksaccous |
whatever floats your boat |
# |
Mar 25th 2019, 17:52 |
ricksaccous |
you could also build the options in the model and pass them to the controller |
# |
Mar 25th 2019, 17:52 |
this.impetus |
something I know how to do, even :P |
# |
Mar 25th 2019, 17:52 |
this.impetus |
nice |
# |
Mar 25th 2019, 17:52 |
ricksaccous |
so you can make it generalizable either way |
# |
Mar 25th 2019, 17:52 |
this.impetus |
^^ |
# |
Mar 25th 2019, 17:51 |
ricksaccous |
well the form select could also be made into an element |
# |
Mar 25th 2019, 17:51 |
this.impetus |
kk, I am going to have this crop up in about a dozen other models so the beforeMarshall() solution sounds more generalizable. gonna go see if I can make it work |
# |
Mar 25th 2019, 17:50 |
ricksaccous |
or you could do it the other way i suggested |
# |
Mar 25th 2019, 17:50 |
ricksaccous |
and then adjust it beforeMarshall |
# |
Mar 25th 2019, 17:50 |
ricksaccous |
if you just want a year by itself what you could do is leave it as is |
# |
Mar 25th 2019, 17:50 |
this.impetus |
oh. ok. I'll try your modifcation of the form control. thanks |
# |
Mar 25th 2019, 17:50 |
ricksaccous |
cakephp does something special with it's datetime selects but the magic only works for datetime fields i think |
# |
Mar 25th 2019, 17:49 |
ricksaccous |
yeah, but it should be a string not an array like that |
# |
Mar 25th 2019, 17:49 |
this.impetus |
hrmm the year value does seem to be read, tho: ```/src/Controller/AssignmentsController.php (line 64) [ 'cvsection_id' => '3', 'cvsubsection_id' => '1', 'servicerole_id' => '3', 'institution_id' => '1', 'description' => 'asdfasdf', 'academic_year' => [ 'year' => '2010' ], 'scv' => '0' ]``` |
# |
Mar 25th 2019, 17:48 |
this.impetus |
lul |
# |
Mar 25th 2019, 17:48 |
ricksaccous |
;) |
# |
Mar 25th 2019, 17:48 |
ricksaccous |
getRequest()->getData() |
# |
Mar 25th 2019, 17:48 |
ricksaccous |
you need to do |
# |
Mar 25th 2019, 17:48 |
this.impetus |
``` if ($this->request->is('post')) { debug($this->getRequest->getData()); exit(); $assignment = $this->Assignments->patchEntity($assignment, $this->request->getData()); ``` throws ``` Call to a member function getData() on boolean``` |
# |
Mar 25th 2019, 17:48 |
ricksaccous |
you can just do $this->Form->control('academic_year', [ 'options' => $arrayOfYearOptions, 'empty' => true]); or something |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
you probably shouldn't use that form control |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
lol |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
i have a feeling you are passing the academic year as an array |
# |
Mar 25th 2019, 17:47 |
this.impetus |
kk |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
debug that before you patch |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
yeah, you can customize them |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
debug $this->getRequest->getData(); |
# |
Mar 25th 2019, 17:47 |
this.impetus |
to be honest that makes me feel significantly better :P the error message, sadly, is also baked in |
# |
Mar 25th 2019, 17:47 |
ricksaccous |
can you |
# |
Mar 25th 2019, 17:46 |
ricksaccous |
i'm not even sure about the default way this works, lol damn |
# |
Mar 25th 2019, 17:46 |
ricksaccous |
wait |
# |
Mar 25th 2019, 17:46 |
ricksaccous |
look at the 'dirty' fields of your entity |
# |
Mar 25th 2019, 17:44 |
this.impetus |
How's that? lines 15 and 41 in the entity both refer to 'academic_year' |
# |
Mar 25th 2019, 17:44 |
ricksaccous |
it's not even in your assignment entity |
# |
Mar 25th 2019, 17:44 |
ricksaccous |
it's not being passed in |
# |
Mar 25th 2019, 17:43 |
ricksaccous |
you're date value isn't even being read |
# |
Mar 25th 2019, 17:43 |
ricksaccous |
lol |