Log message #4157171

# At Username Text
# Jul 10th 2018, 09:13 james.phillips does anyone know who to set api auth under Datasources in app.php?
# Jul 10th 2018, 09:11 neon1024 Perhaps table_alias and primary_key need to be a composite key?
# Jul 10th 2018, 09:11 josbeir so your companies join in Users is also joined in your custom getPermissions query
# Jul 10th 2018, 09:10 neon1024 The above SQL is also taking into account that in my CompaniesTable, the UserPermissions association has a condition set of `'conditions' => ['UserPermissions.table_alias' => 'Companies'],` which isn’t being applied to the join either
# Jul 10th 2018, 09:10 josbeir thats indeed weird
# Jul 10th 2018, 09:01 neon1024 So I feel like I’m stuck between a bad solution and a hack
# Jul 10th 2018, 09:01 neon1024 File uploaded https://cakesf.slack.com/files/U1BT622HW/FBP0U1BM4/sql.sql / https://slack-files.com/T053DPNCM-FBP0U1BM4-50626cdba1
# Jul 10th 2018, 09:01 neon1024 You can contain them, without the left join, but then the query lacks the table alias in the join
# Jul 10th 2018, 09:00 neon1024 File uploaded https://cakesf.slack.com/files/U1BT622HW/FBM2YRZ7S/containing_associations.php / https://slack-files.com/T053DPNCM-FBM2YRZ7S-7c369fec17
# Jul 10th 2018, 09:00 neon1024 Which means using the belongsTo through UserPermissions becomes really hard
# Jul 10th 2018, 09:00 neon1024 ..and it’s taking that condition for the query
# Jul 10th 2018, 09:00 neon1024 All I can think is that Cake is processing the belongsTo association by running a query for Companies to build the association
# Jul 10th 2018, 08:59 neon1024 Why would the conditions from the UserPermissions table be applied to a query for Companies?!
# Jul 10th 2018, 08:59 neon1024 Which to me, seems totally illogical
# Jul 10th 2018, 08:59 neon1024 However if I uncomment the above conditions in the UserPermissions association, I get a failed query for Companies with a where condition of `['UserPermissions.table_alias' => 'Companies']`
# Jul 10th 2018, 08:58 neon1024 It even uses left join by default
# Jul 10th 2018, 08:58 neon1024 Which is bonkers, as the associations job is to do this work for me
# Jul 10th 2018, 08:58 neon1024 File uploaded https://cakesf.slack.com/files/U1BT622HW/FBMGDTH7E/get_permissions.php / https://slack-files.com/T053DPNCM-FBMGDTH7E-2921bacf64
# Jul 10th 2018, 08:57 neon1024 I’ve had to write manual left joins
# Jul 10th 2018, 08:57 neon1024 If you try and inverse it, Cake goes mental
# Jul 10th 2018, 08:57 neon1024 Now this works fine, if you’re looking for Companies and UserPermissions
# Jul 10th 2018, 08:56 neon1024 File uploaded https://cakesf.slack.com/files/U1BT622HW/FBNR5E31D/polymorphic_association.php / https://slack-files.com/T053DPNCM-FBNR5E31D-aaab10c737
# Jul 10th 2018, 08:56 neon1024 UserPermissions belongsTo Companies, Websites and Campaigns. Using `UserPermissions.table_alias` and `UserPermissions.primary_key`.
# Jul 10th 2018, 08:56 josbeir maybe your conditions includes non aliassed keys, no idea
# Jul 10th 2018, 08:56 neon1024 I am using a polymorphic association
# Jul 10th 2018, 08:55 josbeir it can be a number of things :P
# Jul 10th 2018, 08:55 james.phillips Have you defined the associctaions ?
# Jul 10th 2018, 08:54 josbeir @neon1024 its a bit vague as we don have any context of where the query starts etc
# Jul 10th 2018, 08:54 josbeir but i hadn't had any coffee so its probably me
# Jul 10th 2018, 08:53 josbeir my brain can't grasp your issue
# Jul 10th 2018, 08:51 neon1024 Why is it that if I define conditions in my UserPermissions table, when my code queries for the association, which is Companies. It will use that condition in the Companies query and then fail because the UserPermissions table isn’t joined?
# Jul 10th 2018, 08:34 james.phillips @bravo-kernel Will look at the envolpe stuff next time im looking at swagger thanks. Looking into elastic search now... getting a plan together
# Jul 10th 2018, 07:44 neon1024 Your actual error, is just a missing class. Usually caused by a typo, missing autoload in composer, or similar
# Jul 10th 2018, 07:44 neon1024 If it’s a separate application, perhaps you could write directly to it’s database
# Jul 10th 2018, 07:44 neon1024 If you have the source code, just integrate that into your project
# Jul 10th 2018, 07:43 neon1024 If it exposes it’s api using a web service, just integrate with that
# Jul 10th 2018, 07:43 neon1024 Depends how the CRM software exposes it’s api
# Jul 10th 2018, 07:40 sheraliqureshi.mhtech how to integrate 3rd party (like any crm service ) in cake php? Error: Class 'Sugar\sugarRestClient' not found File E:\xampp\htdocs\corbanone-corbanportal-6c1576bf1fdb\src\Controller\AppController.php Line: 149 i am facing this error for yesterday
# Jul 10th 2018, 07:40 sheraliqureshi.mhtech @neon1024
# Jul 10th 2018, 07:34 neon1024 Morning all
# Jul 10th 2018, 06:53 steinkel in a controller, you can use https://github.com/CakeDC/users/blob/master/src/Controller/Component/UsersAuthComponent.php#L152 passing the url in the event