Log message #4180716

# At Username Text
# Mar 25th 2019, 18:30 devito im looking to pass many pairs of and conditions inside the or clause
# Mar 25th 2019, 18:29 devito How do I do OR AND with the orm?
# Mar 25th 2019, 18:07 ricksaccous hehehe
# Mar 25th 2019, 18:06 this.impetus yup; I'm a front-end guy shoe-horned into this back-end nonsense.
# Mar 25th 2019, 17:57 ricksaccous etc
# Mar 25th 2019, 17:57 ricksaccous '2009' => '2009'
# Mar 25th 2019, 17:57 ricksaccous remember that an array of options of key value pairs for the control need to be like
# Mar 25th 2019, 17:53 ricksaccous lol
# Mar 25th 2019, 17:53 ricksaccous yeah
# Mar 25th 2019, 17:53 ricksaccous you could make a model method like buildYearsForController or something
# 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();