Log message #4190803

# At Username Text
# Jun 25th 2019, 18:17 ricksaccous @phpraven no problem, glad i helped out by taking a stab in the dark, lol
# Jun 25th 2019, 18:16 phpraven @ricksaccous just like you said, the association was wrong (plugin name). Thanks
# Jun 25th 2019, 17:24 phpraven ok
# Jun 25th 2019, 17:24 ricksaccous and it's finding the table
# Jun 25th 2019, 17:24 ricksaccous @phpraven make sure you can do $this->Users->Profiles->find() to make sure the association is fine
# Jun 25th 2019, 17:19 phpraven What is weird I can go only to 2 levels deep, $this->Users->Profiles->find() works, but $this->Users->Profiles->Genders->find() not. But when I try this in Profiles controller $this->Profiles->Genders->find() it works.
# Jun 25th 2019, 17:10 phpraven both users and roles are in the same plugin. In my users controller everything works but when I try to get Roles in Profile plugin i see this message.
# Jun 25th 2019, 17:07 phpraven plugins/User/src/Model/Table
# Jun 25th 2019, 17:06 phpraven let me check first
# Jun 25th 2019, 17:06 ricksaccous or User/src/Model/Table I mean
# Jun 25th 2019, 17:06 phpraven yes
# Jun 25th 2019, 17:06 ricksaccous @phpraven are your files in Users/src/Model/Table folder?
# Jun 25th 2019, 17:06 phpraven maybe I made a mistake somewhere to polish
# Jun 25th 2019, 17:05 phpraven @ricksaccous I think so
# Jun 25th 2019, 17:04 ricksaccous of the usersTable class?
# Jun 25th 2019, 17:04 ricksaccous @phpraven did you define the relationship in initialize?
# Jun 25th 2019, 16:34 nucc1 slackebot: if you're using PHP7+, you can create your arrays simply by using ['User-Agent' => 'TEST']. No need for array( ).
# Jun 25th 2019, 16:15 phpraven Hello, I'm getting this error message: The Roles association is not defined on Users. I need user role, how can I contain role in this query
# Jun 25th 2019, 16:06 nucc1 like, i've already set function add() for handling the Adding, if i wanted a REST method of doing something, i suppose i have to create something like function restAdd() ?
# Jun 25th 2019, 16:05 nucc1 when adding a restful route to my application, do i have to have separate methods for both the REST and non-REST request?
# Jun 25th 2019, 15:32 ricksaccous no problem
# Jun 25th 2019, 15:32 a.didier thank
# Jun 25th 2019, 15:32 a.didier I was doing something wrong don't find what and now it's works with ``` $HTTPSocket = new HttpSocket(array('request'=>array('header'=>array("User-Agent"=>"TEST"))));```
# Jun 25th 2019, 15:26 ricksaccous but yeah, hopefully the constructor way just works
# Jun 25th 2019, 15:26 ricksaccous if that doesn't work try passing it in, you could probably just set the request array as a variable and pass it to all three
# Jun 25th 2019, 15:24 a.didier i'll try to pass it inside the constructor
# Jun 25th 2019, 15:24 a.didier i use the wrapper get but i want this to work over get post put... ``` $HTTPSocket = new HttpSocket(); $HTTPSocket->request['header']['User-Agent'] = "MyUserAgent"; $response = $HTTPSocket->get($full_url); debug($response); ``` With this i call an other site that's telling me my user agent is still CakePHP.
# Jun 25th 2019, 15:24 ricksaccous new HttpSocket(array('request' => array('header' => array('User-Agent' => 'My Agent
# Jun 25th 2019, 15:23 ricksaccous it says in the comments that that's read only
# Jun 25th 2019, 15:23 ricksaccous in order for it to work
# Jun 25th 2019, 15:23 ricksaccous you'd have to set that in the constructor
# Jun 25th 2019, 15:22 ricksaccous also
# Jun 25th 2019, 15:21 ricksaccous or are you not using those?
# Jun 25th 2019, 15:21 ricksaccous are you using get or post?
# Jun 25th 2019, 15:21 a.didier ``` $HTTPSocket = new HttpSocket(); $HTTPSocket->request['header']['User-Agent'] = "My User Agent" ``` Didn't do anything, i've still the "CakePHP" for User-Agent...
# Jun 25th 2019, 15:19 ricksaccous should over-ride it
# Jun 25th 2019, 15:18 ricksaccous https://github.com/cakephp/cakephp/blob/2.x/lib/Cake/Network/Http/HttpSocket.php#L47 that's the default i guess but you can feed it your own params in the third param of get, post, patch, etc
# Jun 25th 2019, 15:16 ricksaccous User-Agent is just a header thing right?
# Jun 25th 2019, 15:16 ricksaccous which i think is the third param if you use get or post
# Jun 25th 2019, 15:15 ricksaccous in the request
# Jun 25th 2019, 15:15 ricksaccous @a.didier yeah I think you just set the 'header' array