Log message #4153187

# At Username Text
# Jun 22nd 2018, 08:04 birdy247 no not at all
# Jun 22nd 2018, 08:04 neon1024 #braindump
# Jun 22nd 2018, 08:03 neon1024 Sorry, that sounds like a lecture reading it back.
# Jun 22nd 2018, 08:03 neon1024 Trying to write tests for events in something, Crud I think, was quite tough
# Jun 22nd 2018, 08:02 neon1024 *imho
# Jun 22nd 2018, 08:02 neon1024 Class abstractions will be ten billion times easier to test than events
# Jun 22nd 2018, 08:02 birdy247 I am keen to get things working (mvp) and ensure all tests are passing, then we can refactor
# Jun 22nd 2018, 08:01 birdy247 I agree, I expect this code to go through many iterations before we are 100% happy with it
# Jun 22nd 2018, 08:00 neon1024 If the objects are as tightly coupled as you say
# Jun 22nd 2018, 08:00 neon1024 `$stationary->hasPen() { // Drawing }`
# Jun 22nd 2018, 08:00 neon1024 Then I can work with the Collection abstraction and query it to know if certain objects exist
# Jun 22nd 2018, 08:00 neon1024 Like a collection concept
# Jun 22nd 2018, 08:00 neon1024 Stationary class which composes other class instances of Pen, Ruler, etc
# Jun 22nd 2018, 07:59 neon1024 So you might also push up to a Super class
# Jun 22nd 2018, 07:59 neon1024 I’m creating a collection of objects
# Jun 22nd 2018, 07:59 neon1024 As I’m not really creating a Pen
# Jun 22nd 2018, 07:59 neon1024 Then I could call that anywhere in my application whenever I wanted to create a Pen
# Jun 22nd 2018, 07:59 neon1024 ..and leave the dependent calculation wrapped in a class or single method
# Jun 22nd 2018, 07:59 neon1024 So that I could call a method with some data, and get back the objects I need
# Jun 22nd 2018, 07:58 neon1024 If anything I would try and abstract the dependent nature into it’s own class at least
# Jun 22nd 2018, 07:58 neon1024 Yeah, but there is no need to use events for that, as you’ll surely know that when you create your Pen
# Jun 22nd 2018, 07:58 birdy247 A Ruler can only be saved after a Pen. Not all Pens create Rulers
# Jun 22nd 2018, 07:57 neon1024 Then I would think about front-loading the problem, to manage the conditional nature earlier, so I could save everything in one go
# Jun 22nd 2018, 07:57 neon1024 This scenario makes me stop and think, this is a code smell. Where does my software design stink enough that I need so many dependent events
# Jun 22nd 2018, 07:55 birdy247 I would also like Rulers to be returned if they were saved
# Jun 22nd 2018, 07:55 birdy247 actually I didnt explain this well.. A "Paper" is saved.. in the afterSave of paper, an event is emitted. This event then saves a Pen, which may then save a Ruler in the afterSave. Pens are then returned to the "Paper" in the event result
# Jun 22nd 2018, 07:53 neon1024 So if anything was observing that event it could get both entities in the event subject
# Jun 22nd 2018, 07:53 neon1024 Then I could pass both the Pen and Ruler with the event
# Jun 22nd 2018, 07:53 birdy247 ah right, which contains the Pen id?
# Jun 22nd 2018, 07:52 birdy247 I thought about stamping some guid on the records to show they are linked, and then performing a find with any records matching these guids
# Jun 22nd 2018, 07:52 neon1024 So in the afterSave if a Ruler was created, I would emit an event there
# Jun 22nd 2018, 07:52 neon1024 I would use an event
# Jun 22nd 2018, 07:51 birdy247 The result gets passed elsewhere
# Jun 22nd 2018, 07:51 birdy247 @tim Its not for display
# Jun 22nd 2018, 07:42 tim @birdy247 Where/why do you need to know this? If it's just for displaying purposes, use FlashComponent
# Jun 22nd 2018, 07:41 tim I'm unsure, we don't use bake here so I'm not that familiar with it :P
# Jun 22nd 2018, 07:40 ra7bi Okay i will try now So by baking that structure cake will create for me that forms ?
# Jun 22nd 2018, 07:39 tim The tables are fine (ideally it should be called fishes_shipments but you can just set the name you're using in your association)
# Jun 22nd 2018, 07:38 ra7bi @tim can you give simple example how tables should look like? Currently I've Fishes Shipments Shipments_fishes ( shipment_id,fish_id)
# Jun 22nd 2018, 07:36 tim @ra7bi You need to save your shipment before the shipment_fishes, otherwise it will have no ID and thus can't put that in the pivot table. If you use proper associations and form keys/names, it should all do this for you
# Jun 22nd 2018, 07:35 ra7bi I don't really know