# |
Oct 6th 2016, 18:47 |
admad |
I'll update the comment when i am on pc |
# |
Oct 6th 2016, 18:46 |
Leidenfrost |
slackebot->nemmons yes, but for some reason Users->Manager->Vendor isn't shown |
# |
Oct 6th 2016, 18:46 |
hmic |
good for clarifying ;-) |
# |
Oct 6th 2016, 18:46 |
nemmons |
Ah okay, that makes things make a hell of a lot more sense. Thank you both very much. |
# |
Oct 6th 2016, 18:46 |
hmic |
because, like neomons says, beforeRender does not make quite sense for "component initialisation not run" as they are needed in the action, which executes before beforeRender does :p |
# |
Oct 6th 2016, 18:46 |
admad |
I did mean beforeFilter and read as such too right now :) |
# |
Oct 6th 2016, 18:44 |
hmic |
i answered nemmons, and i did read beforeFilter in your answer he pasted :p |
# |
Oct 6th 2016, 18:44 |
hmic |
admad: you sure you did not mean beforeFilter instead of beforeRender? |
# |
Oct 6th 2016, 18:44 |
nemmons |
Okay. Thank you for your time. |
# |
Oct 6th 2016, 18:43 |
admad |
s/have/gave |
# |
Oct 6th 2016, 18:43 |
admad |
I have the order if execution of the methods. Don't know any other way of stating the same |
# |
Oct 6th 2016, 18:43 |
nemmons |
I didn't make any excuses. I agreed that your suggestion was correct and then gave the explanation for why i was unable to follow it |
# |
Oct 6th 2016, 18:42 |
nemmons |
I'm not asking for a code change. I'm simply trying to understand how the code as written makes sense given you remark |
# |
Oct 6th 2016, 18:42 |
slackebot |
controller::initialise(), do it in beforeFilter()" and answer to my question? |
# |
Oct 6th 2016, 18:42 |
nemmons |
You said "A table initialized in Controller::beforeRender() won't get the footprint since AuthComponent::startup() has still not run." My question was "Looking in Http/ActionDispatcher->_invoke() it looks to me like component startup methods are definitely called before Controller::beforeRender().. Is it possible this has changed since May when you said this, or am i horribly misreading this code?" how is "don't initialise tables in |
# |
Oct 6th 2016, 18:42 |
admad |
The code hasn't changed since my comment and unlikely to change |
# |
Oct 6th 2016, 18:41 |
admad |
Answer came first, then the snark since you gave a lame excuse for being unable to follow advice given |
# |
Oct 6th 2016, 18:40 |
nemmons |
No, you didn't answer me. I asked a very specific question and you gave a snarky response that was only tangentially related to what i asked. |
# |
Oct 6th 2016, 18:40 |
admad |
Answered |
# |
Oct 6th 2016, 18:40 |
admad |
And i answer you :) |
# |
Oct 6th 2016, 18:39 |
nemmons |
I was just trying to ask an honest question to try and better understand the code base |
# |
Oct 6th 2016, 18:39 |
admad |
Well sucks to be you then |
# |
Oct 6th 2016, 18:38 |
nemmons |
i completely agree with you and if i was in total control of my codebase and had time to refactor a bunch of poorly-written stuff i would definitely do so |
# |
Oct 6th 2016, 18:38 |
admad |
@nemmons don't initialise tables in controller::initialise(), do it in beforeFilter(). Problem solved |
# |
Oct 6th 2016, 18:19 |
nemmons |
well, i guess it's more precise to say Users loaded through the Manager association will still have Vendors attached |
# |
Oct 6th 2016, 18:18 |
nemmons |
Users that happen to be Managers will still have Vendors attached |
# |
Oct 6th 2016, 18:17 |
nemmons |
associations define relationships between tables, so Vendor belongsTo User |
# |
Oct 6th 2016, 18:13 |
Leidenfrost |
Now, another question. I created the 'Manager' relationship with itself. The 'User' has a table Vendors that is usually attached with a belongsTo from Vendor. Tried, instead, creating a belongsTo in Vendor model that links to this new 'Manager' association but I couldn't make it work. And yes, I'm using find with recursion = 2 |
# |
Oct 6th 2016, 18:12 |
birdy247 |
What is the best way to have this set to 0 if the user leaves it blank |
# |
Oct 6th 2016, 18:11 |
birdy247 |
if i dont fill it in, I get an exception saying it cannot be null |
# |
Oct 6th 2016, 18:11 |
birdy247 |
It is allowedEmpty |
# |
Oct 6th 2016, 18:11 |
birdy247 |
and have a field called event_count which is an int |
# |
Oct 6th 2016, 18:11 |
birdy247 |
I baked a form |
# |
Oct 6th 2016, 18:05 |
CoderJon |
Thanks for the direction! Found it in http://book.cakephp.org/3.0/en/orm/entities.html#validation-errors and not in the saving data section, lol |
# |
Oct 6th 2016, 18:05 |
michaelze |
CoderJon: You can also pass a field's name to the errors() method in order to retrieve specific information about only one field's error... |
# |
Oct 6th 2016, 18:05 |
nemmons |
it will be an array containing fields and error messages |
# |
Oct 6th 2016, 18:05 |
nemmons |
Yup |
# |
Oct 6th 2016, 18:04 |
CoderJon |
Ohhh, so something like $article->errors() ? It wasn't listed in the save section of the book. |
# |
Oct 6th 2016, 18:01 |
michaelze |
CoderJon: You can use the EntityTrait::errors() method on the entity that failed to save... |
# |
Oct 6th 2016, 18:00 |
escape |
CoderJon, from the entity |
# |
Oct 6th 2016, 17:59 |
CoderJon |
If your save fails in cakephp 3, how do you get the error message in the controller? |