# |
Sep 29th 2016, 20:32 |
adityapansari |
http://localhost:8765/appointments/appointment-report?from_date=2016-09-01andto_date=2016-09-03& |
# |
Sep 29th 2016, 20:31 |
adityapansari |
date |
# |
Sep 29th 2016, 20:31 |
ndm |
in your request |
# |
Sep 29th 2016, 20:30 |
ndm |
@adityapansari What value are you passing for the `created` field of your callback filter? |
# |
Sep 29th 2016, 20:27 |
adityapansari |
->add('patient_id', 'Search.Like', [ 'before' => true, 'after' => true, 'field' => [$this->Patients->aliasField('id')]], ['filterEmpty' => true]) |
# |
Sep 29th 2016, 20:27 |
adityapansari |
And this one is working fine. |
# |
Sep 29th 2016, 20:26 |
adityapansari |
*tried debugging |
# |
Sep 29th 2016, 20:26 |
adityapansari |
I also tried the code , I found that callback is not executing. please help! |
# |
Sep 29th 2016, 20:19 |
kitcat711_ |
even when i remove the UsersController.php file |
# |
Sep 29th 2016, 20:19 |
kitcat711_ |
got a strange warning: Headers already sent in /mycakeApp/src/Controller/Api/UsersController.php:46 |
# |
Sep 29th 2016, 20:19 |
kitcat711_ |
bonsoir |
# |
Sep 29th 2016, 20:16 |
adityapansari |
I also try this - ->add('created', 'Search.Callback', [ 'callback' => function ($query, $args, $manager) { return $query->andWhere(["Events.start >=" => new FrozenTime($args['from_date'])]) ->andWhere(["Events.start =" = new FrozenTime($args['to_date'])]); } ]); but it also did not work. |
# |
Sep 29th 2016, 20:15 |
slackebot |
it is not working. |
# |
Sep 29th 2016, 20:15 |
adityapansari |
Hey , I am using search plugin https://github.com/FriendsOfCake/search> So , In my events table , I added - $this->searchManager() ->add('created', 'Search.Callback', [ 'callback' => function ($query, $args, $manager) { return $query->andWhere(["Events.start >=" => $args['from_date']]) ->andWhere(["Events.start <=" = $args['to_date']]); } |
# |
Sep 29th 2016, 20:07 |
associatee |
You see, there's an associated row that actually satisfies the matching condition, but it's not being loaded |
# |
Sep 29th 2016, 20:07 |
associatee |
>contain(['PpcConjuntosEquivalencias' => function($q) use ($projetoId){ return $q->matching('Representante.ProjetoEstruturas', function($sq) use ($projetoId) { return $sq->where(['ProjetoEstruturas.projeto_id' => $projetoId]); }); |
# |
Sep 29th 2016, 20:07 |
associatee |
but it's not working properly |
# |
Sep 29th 2016, 20:06 |
associatee |
but I want to filter by sub associations |
# |
Sep 29th 2016, 20:06 |
sazpaimon |
mind you, my cake knowledge is very limited so I could be missing something |
# |
Sep 29th 2016, 20:06 |
associatee |
So I pass a query to the contain |
# |
Sep 29th 2016, 20:06 |
associatee |
but I want to filter it |
# |
Sep 29th 2016, 20:06 |
associatee |
I'm loading an association |
# |
Sep 29th 2016, 20:06 |
associatee |
hey guys |
# |
Sep 29th 2016, 20:05 |
sazpaimon |
If I use a component, then I can simply mock that component in $this->generate() and not have to mock out any of the controller methods |
# |
Sep 29th 2016, 20:03 |
sazpaimon |
how do I load a service class via $components/helpers/uses? That's kind of my goal here |
# |
Sep 29th 2016, 20:01 |
admad |
s/i/it |
# |
Sep 29th 2016, 20:00 |
admad |
though i can be just a general service class, doesnt have to be a component |
# |
Sep 29th 2016, 20:00 |
admad |
a wrapper class sounds good. |
# |
Sep 29th 2016, 20:00 |
sazpaimon |
only thing I can think of is make a very thin wrapper using a component, that way I can mock the SDK in $this->generate(...) |
# |
Sep 29th 2016, 19:59 |
sazpaimon |
problem is, I don't see an easy way to mock the facebook sdk in my controller unit tests. |
# |
Sep 29th 2016, 19:58 |
sazpaimon |
for instance, I want to load the Facebook SDK for a controller. The only plugin for 2.x hasn't been updated in years and uses an unsupported SDK version, so I'll need to load the latest SDK version via composer |
# |
Sep 29th 2016, 19:56 |
sazpaimon |
they aren't dev dependencies |
# |
Sep 29th 2016, 19:55 |
admad |
*load |
# |
Sep 29th 2016, 19:55 |
admad |
sazpaimon: why not just loading the dependencies using "require-dev" ? |
# |
Sep 29th 2016, 19:47 |
sazpaimon |
seems like the best way would be to wrap the dependency in a component and mock the component out in the controller test |
# |
Sep 29th 2016, 19:47 |
sazpaimon |
in cake 2, is there a way to load composer dependencies in a way that can be mocked when testing a controller? |
# |
Sep 29th 2016, 19:47 |
prepender |
with collections its like name => rows |
# |
Sep 29th 2016, 19:42 |
prepender |
I want to do like Index => [ name => name, rows => rows ] |
# |
Sep 29th 2016, 19:41 |
prepender |
I dont like how the array key is the column title |
# |
Sep 29th 2016, 19:41 |
prepender |
but I wish it formatted a little different |
# |
Sep 29th 2016, 19:34 |
Leonardo_0112 |
harry1: thanks |