Log message #4190962

# At Username Text
# Jun 26th 2019, 21:50 cnizzardini Does cake have anything like laravels collections?
# Jun 26th 2019, 21:30 mdotobie When a new Modelless Form is instantiated, I can’t for the life of me figure out how the `schema()` method is getting called. I can override the `_buildSchema()` method in the subclass, but I can’t see where `schema()` is getting called in the first place in order to get to the `_buildSchema()` method. It isn’t in the constructor.
# Jun 26th 2019, 19:43 mdotobie I’ve reasoned that I can additionally create a new `ContextInterface` that I will call `GraphContext` that will be used by the `FormHelper` class to utilize the custom properties on each field in the `GraphSchema`
# Jun 26th 2019, 19:41 mdotobie So @admad, I’ve spent the last few hours on the problem I was starting to discuss earlier and my first step towards a solution has been to write a subclassed version of the `Cake\Form\Schema` class. I’m calling it a `GraphSchema`. This way I can define custom properties for each field through the `addField()` method in addition to the `type`, `length`, `precision` and `default` fields setup by the parent `Schema` class.
# Jun 26th 2019, 16:33 michal.ferak that works! thank you for your help @admad
# Jun 26th 2019, 16:33 michal.ferak thanks, I think perhaps like this: $this->response = $this->response->withStatus(400);
# Jun 26th 2019, 16:32 admad `$this->response = $this->response->withStatuCode(400);`
# Jun 26th 2019, 16:31 admad Apologies, I misread your code. I fixed the code in my previous comment too
# Jun 26th 2019, 16:30 slackebot <michal.ferak>
# Jun 26th 2019, 16:29 slackebot <michal.ferak>
# Jun 26th 2019, 16:27 admad @michal.ferak what you claim as deprecated isn't. You jus need to change bit to `$this->response = $this->response->statusCode(400);`
# Jun 26th 2019, 16:22 slackebot <michal.ferak>
# Jun 26th 2019, 16:21 michal.ferak Let me rephrase. The method I posted earlier is in fact a controller method. I adjusted the original example.
# Jun 26th 2019, 16:17 niel45 Can I get an invite to the slack workspace?
# Jun 26th 2019, 16:17 michal.ferak Thanks. Not sure I follow what you mean. I tried modifying `$this->status` directly but that didn’t work
# Jun 26th 2019, 16:13 admad You can directly use the property too
# Jun 26th 2019, 16:13 michal.ferak @admad Thanks, this works - is it a correct approach? $this->setResponse($this->response->withStatus($response->getStatusCode()));
# Jun 26th 2019, 16:12 admad By returning it directly you are preventing the normal rendering
# Jun 26th 2019, 16:11 admad @michal.ferak nope, you can still do the same in controller, just remember to assign back the return value to $this->response
# Jun 26th 2019, 16:07 michal.ferak Any help would be much appreciated :slightly_smiling_face:.
# Jun 26th 2019, 16:02 michal.ferak Hi guys, anyone I could talk to regarding how to properly send a json response (without a view) with a custom code? Here’s a snippet I have, which returns a correct response code, but no data.
# Jun 26th 2019, 16:02 slackebot <michal.ferak>
# Jun 26th 2019, 14:37 dereuromark afaik it hooks itself into it, see code.
# Jun 26th 2019, 14:34 flxfoo Does anyone knows if `session_gc()` would call `DatabaseSession::gc()`
# Jun 26th 2019, 14:33 flxfoo hi again,
# Jun 26th 2019, 14:21 mdotobie let me try to pull that together
# Jun 26th 2019, 14:17 mdotobie thanks @ndm
# Jun 26th 2019, 14:15 ndm @mdotobie Code examples are always helpful. Show how you're building the form, and explain what it is about the code that you're concerned with, what "defining a structure" means in that context, what these "changes" are and how they affect the form building process, etc...
# Jun 26th 2019, 14:01 mdotobie (I’m struggling how to succinctly give context to what I’m asking - I’m going to think on it a bit more and come back)
# Jun 26th 2019, 14:00 mdotobie But I need custom controls, for instance the third dropdown in each row for selecting Revision or Approval is implemented as a method with a `Cell` subclass but should probably be a subclassed `Wdiget`
# Jun 26th 2019, 13:59 mdotobie I would have liked to use the `_schema` property of the `Form` class but it seems limited to just defining fields for auto-detecting what control type to render with FormHelper.
# Jun 26th 2019, 13:58 mdotobie My biggest design struggle is around the way I “define” the structure of what eventually becomes the fields
# Jun 26th 2019, 13:57 mdotobie this is an example.
# Jun 26th 2019, 13:57 mdotobie https://lpflow.ngrok.io/ns/job/ec6ef907-0914-4ede-82ea-eb8c3e0ef91b/approval/158.1560359754
# Jun 26th 2019, 13:55 mdotobie I have a Form that is intended to allow a user to Approve or Request Revision for a group of settings for a Job they’ve placed.
# Jun 26th 2019, 13:54 mdotobie So I need a bit of architectural advice. I’m trying to redesign a feature of my app to take better advantage of the CakePHP structure because every time I have to make a change it’s a bit of a nightmare to re-approach the code.
# Jun 26th 2019, 12:25 admad yeah cronjob would be the easiest
# Jun 26th 2019, 12:19 flxfoo admad: thanks, I did try to play with settings (even making divider=probability with a maxlifetime=1) no deleteAll is called. So I suppose a cronjob has to be set.
# Jun 26th 2019, 11:51 admad @jeremy.payne you can achieve the same with find('list') too if you read the API and pass it proper options :slightly_smiling_face:
# Jun 26th 2019, 11:49 admad flxfoo: you need to either set proper values in php.ini so that it runs the session gc at required intervals or clear the db records yourself with a cronjob
# Jun 26th 2019, 11:38 jeremy.payne Hi all, in Cake2 you could query a model with `->find('list', ['Campaigns.id', 'Campaigns.name', 'Campaigns.channel'])` and it would produce an array with the channel as a key and `[id => name]` as values. I can't seem to get this set up in Cake3. Is this still possible and I am missing something obvious? Thanks :slightly_smiling_face: