# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
When I do the debug, I'm getting the correct recommendations, it's just the last line I think I may be doing wrong. |
# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
} |
# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
$data['recommendations']['_ids'] = $query['id']; |
# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
//debug($query); |
# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
->all(); |
# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
->where([$data['recommendationgroup_id'] => 'recommendation_group_id']) |
# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
->select(['id']) |
# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
->disableHydration() |
# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
$recommendations = TableRegistry::get('Recommendations'); |
# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
$query = $recommendations->find() |
# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
{ |
# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
public function beforeMarshal(\Cake\Event\Event $event, \ArrayObject $data, \ArrayObject $options) |
# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
I'm doing this: |
# |
Feb 18th 2020, 18:28 |
FunkadelicRelic |
@ndm - Hey - sorry to bug you again, but I've been trying to implement your suggestion for earlier about the beforeMarshal and adding recommendations to my assessment. I'm getting there I think but I'm just getting caught up actually modifying the data. |
# |
Feb 18th 2020, 15:57 |
birdy247 |
then the id was as expected |
# |
Feb 18th 2020, 15:56 |
birdy247 |
I had to select '*', 'p.id' |
# |
Feb 18th 2020, 15:32 |
neon1024 |
With auto-incrementing id’s is often easy to mistake id’s :) |
# |
Feb 18th 2020, 15:32 |
neon1024 |
Perhaps the id you’re expecting is in row 2? |
# |
Feb 18th 2020, 15:31 |
neon1024 |
I would also consider that because you’ve got `limit(1)` you might be getting more than one record back, and thus your expecting to see something and instead seeing something else |
# |
Feb 18th 2020, 15:30 |
neon1024 |
You already are with `select *` right? |
# |
Feb 18th 2020, 15:22 |
birdy247 |
Or would I have to select every field in the select clause |
# |
Feb 18th 2020, 15:22 |
birdy247 |
Is there a way to ensure that the ID selected is that of purchases |
# |
Feb 18th 2020, 15:21 |
birdy247 |
Where I check $legacyPurchase['id'] it is giving me the ID of the merchandise not the purchase |
# |
Feb 18th 2020, 15:21 |
slackebot |
->fetchAll('assoc');``` |
# |
Feb 18th 2020, 15:21 |
birdy247 |
``` $legacyPurchases = $this->migrationConfig ->getLegacyConnection() ->newQuery() ->select(['*']) ->from(['p' => 'purchases']) ->innerJoin(['v' => 'variations'], ['v.id = p.variation_id']) ->innerJoin(['m' => 'merchandises'], ['m.id = v.merchandise_id']) ->where(['m.organiser_id' => $this->organiserId]) ->limit(1) ->execute() |
# |
Feb 18th 2020, 15:21 |
birdy247 |
Consider this code: |
# |
Feb 18th 2020, 15:21 |
birdy247 |
Hi |
# |
Feb 18th 2020, 14:42 |
spriz |
Ah yes, but I expected only the keyField, valueField and the group would be included in the SELECT :) |
# |
Feb 18th 2020, 14:40 |
g.catania |
I’m stuck… |
# |
Feb 18th 2020, 14:39 |
g.catania |
everything works as expected except at that point I’m no longer able to limit my restful actions using resources with ‘map’ options |
# |
Feb 18th 2020, 14:38 |
g.catania |
```$routes->fallbacks(InflectedRoute::class);``` |
# |
Feb 18th 2020, 14:38 |
g.catania |
if I remove $routes->resources(‘’) and put this: |
# |
Feb 18th 2020, 14:37 |
g.catania |
what I’m experiencing though is an error ‘Controller class Api could not be found’ |
# |
Feb 18th 2020, 14:36 |
g.catania |
expected behavior: correctly map my url ‘/api/cocktails’ to controller ‘Cocktails’ declared inside src/Controller/Api/CocktailsController.php |
# |
Feb 18th 2020, 14:35 |
g.catania |
```Router::prefix('api', function ($routes) { $routes->resources('Cocktails'); });``` |
# |
Feb 18th 2020, 14:35 |
g.catania |
Hi there… I’m running cakephp 3.0.x (can’t update it) and I’m experiencing an unexpected behavior in regard of prefix routes. I’m trying to set a prefixed route ‘api’ and inside my callback I’d like to define my resource. My code: |
# |
Feb 18th 2020, 14:19 |
ndm |
Oh well, I guess I worded that rather poorly, it is of course use in the `SELECT` clause, but it's _also_ passed to `Collection::combine()` for formatting the results of the query, where it is expected to be a string, or a callable that returns a string. |
# |
Feb 18th 2020, 14:16 |
spriz |
@ndm Damn! I thought it was actually used in the SELECT ,:) |
# |
Feb 18th 2020, 14:05 |
neon1024 |
Afaik the email takes an array of helpers |
# |
Feb 18th 2020, 14:05 |
neon1024 |
Did you pass it in? |
# |
Feb 18th 2020, 12:54 |
jotpe |
(even if loaded with Plugin Syntax) |