Log message #4032727

# At Username Text
# May 26th 2017, 10:56 obinoob hmic: either by a static method TableRegistry or by calling $this->table
# May 26th 2017, 10:56 hmic through the TableRegistry! this is the most commonly used/exposed registry that cake provides. but there are more. they are globally accessible and provide you with object instances
# May 26th 2017, 10:55 hmic how do you access a table object?
# May 26th 2017, 10:55 hmic think of the tables classes again please
# May 26th 2017, 10:54 obinoob and I could call it on the class that I will be using the trait
# May 26th 2017, 10:54 hmic thats not what you want
# May 26th 2017, 10:54 hmic still you need to access the same object instance from there, so you need to pass it in
# May 26th 2017, 10:54 obinoob hmic: but I can have a constructor on a trait
# May 26th 2017, 10:54 hmic additionally, you dont want to pass the object instance around likely
# May 26th 2017, 10:53 hmic only the object the trait is attached to can have state.
# May 26th 2017, 10:53 hmic first off: a trait has no state.
# May 26th 2017, 10:53 obinoob hmic: ok I get the ideia and I agree with it, but lets pretend i need to create some custom class it can be a component it doesn't matter for the example
# May 26th 2017, 10:50 hmic this can be added from a trait, if you think thats a good idea. i dont. it could be a behavior attached to your table too, which sounds way better
# May 26th 2017, 10:49 hmic wait, the user database queries should be custom finders *in your table*
# May 26th 2017, 10:49 obinoob hmic: *sorry a single UserData instance
# May 26th 2017, 10:48 obinoob hmic: I've a trait that I am using for app business rules in controller but I've found that i could make my life much simpler if i could wrap all user database queries in a class so now I need a way of create a single UserData class to use in my trait
# May 26th 2017, 10:46 hmic and the usecase
# May 26th 2017, 10:46 hmic obinoob, maybe you explain your goal first
# May 26th 2017, 10:45 obinoob I don't want to create a new object instance in every method, I'm sure there must be a way ;) a cakes way
# May 26th 2017, 10:42 obinoob also tried to implement lazy loading without success, so if there is somebody willing to help me on this new topic I would be very happy
# May 26th 2017, 10:41 obinoob Hi, after a lot of efforts I still don't know how to create an object instance on a trait, the object should be available in trait global scope so I could share it across multiple methods. I've tried a constructor function and initialise method as well none has worked
# May 26th 2017, 10:17 Neon1024 }
# May 26th 2017, 10:17 Neon1024 unset($this->request->data['hub']);
# May 26th 2017, 10:17 Neon1024 if (empty($this->request->getData('hub')) andand !empty($this->request->getData('hub_id'))) {
# May 26th 2017, 10:17 Neon1024 I’m here currently
# May 26th 2017, 10:17 Neon1024 But the key still exists in the post data then
# May 26th 2017, 10:17 Neon1024 $this->request = $this->request->withData(‘hub’, null);
# May 26th 2017, 10:16 Neon1024 All I can think is
# May 26th 2017, 10:16 Neon1024 Then the existing one would still be there, be caught by the validation and the save would fail
# May 26th 2017, 10:12 steinkel using the current spec, you could add another data key to match this condition, like 'hub_deleted'
# May 26th 2017, 10:10 hmic there has been quite some noise on that on the mailing list before i think...
# May 26th 2017, 10:10 hmic Neon1024, i'm on your side. i think they sould eighter remove methods to add data to the request or add methods to delete them too in the psr-7 spec
# May 26th 2017, 10:08 Neon1024 So in 4.0 you’ll not be able to remove keys and values from the request, unless a method is added
# May 26th 2017, 10:08 NeoTherm1c|Work hmic, I know that I need to check for breakage for 2.8 from 2.7, looking at the changes I might also need to double check how we see IP addresses and evaluate anything that might be using the Object
# May 26th 2017, 10:08 Neon1024 There is no method to match unset($ths->request->data[‘hub’])
# May 26th 2017, 10:08 Neon1024 So I have to check for the foreign key or new data, and adjust the request data
# May 26th 2017, 10:08 Neon1024 I can’t pass context to the association validation
# May 26th 2017, 10:07 Neon1024 With select existing or add new
# May 26th 2017, 10:07 Neon1024 My form has both parent and association
# May 26th 2017, 10:07 hmic steinkel: the idea comes from the possibility to add data to the request as per psr-7, but not beeing able to remove...
# May 26th 2017, 10:06 steinkel it's not part of http://www.php-fig.org/psr/psr-7/ why would you need to remove it?