# |
Aug 13th 2019, 09:45 |
neon1024 |
It can lead to sub-standard test-cases |
# |
Aug 13th 2019, 09:45 |
neon1024 |
Chasing coverage is dangerous |
# |
Aug 13th 2019, 09:44 |
challgren |
I had 100% at one time but it dropped to 80% and Im sad about it, but need to focus on getting it back up to 100% |
# |
Aug 13th 2019, 09:43 |
neon1024 |
So you can use it later again if needed |
# |
Aug 13th 2019, 09:43 |
neon1024 |
..and you’ll have added an alias to the Registry |
# |
Aug 13th 2019, 09:43 |
neon1024 |
Then you can use the return @val |
# |
Aug 13th 2019, 09:43 |
challgren |
Yes so you use $Example2->find() as your subquery |
# |
Aug 13th 2019, 09:43 |
neothermic |
@challgren unit tests. Working from critical parts forward |
# |
Aug 13th 2019, 09:43 |
slackebot1 |
<neon1024> |
# |
Aug 13th 2019, 09:43 |
challgren |
Are you just doing integration tests? |
# |
Aug 13th 2019, 09:42 |
val |
@challgren the same problem. I need the alias to be applied only to a single subquery. |
# |
Aug 13th 2019, 09:42 |
neon1024 |
Probably something like `$t = new TableLocator(); $t->get(‘Cat’, [ ‘className’ => \App\Model\Table\DogsTable::class ])` |
# |
Aug 13th 2019, 09:42 |
neothermic |
0.9% of 500k is still a lot of lines tested |
# |
Aug 13th 2019, 09:42 |
challgren |
Damm figured you’d be at least 5% |
# |
Aug 13th 2019, 09:41 |
neothermic |
argh, 0.9% covered. gotta keep going to hit that first 1% |
# |
Aug 13th 2019, 09:41 |
challgren |
`$Example2 = TableRegistry::getTableLocator()->get('Example')->setAlias('Example2');` |
# |
Aug 13th 2019, 09:41 |
neon1024 |
So I guess you’d need to load a new aliased instance |
# |
Aug 13th 2019, 09:40 |
neon1024 |
Although as Cake uses the Registry pattern you’ll always be changing the same instance, unless you clone it as @challgren said |
# |
Aug 13th 2019, 09:40 |
neon1024 |
`$query->getRepository()->setAlias();` |
# |
Aug 13th 2019, 09:39 |
challgren |
Yep not defined. |
# |
Aug 13th 2019, 09:39 |
val |
I can't find `setAlias` in Query class |
# |
Aug 13th 2019, 09:39 |
neon1024 |
Call it on the query instance instead of the table? |
# |
Aug 13th 2019, 09:37 |
challgren |
Try it first and see |
# |
Aug 13th 2019, 09:37 |
challgren |
You could clone it |
# |
Aug 13th 2019, 09:36 |
val |
not what is needed |
# |
Aug 13th 2019, 09:36 |
challgren |
I could see that happening |
# |
Aug 13th 2019, 09:35 |
val |
@challgren wouldn't this set 'Example2' alias for all consecutive queries to Example table? |
# |
Aug 13th 2019, 09:35 |
Martin` |
When do I need to use Aliasses? |
# |
Aug 13th 2019, 09:34 |
challgren |
`$this->Example->setAlias('Example2')->find()` |
# |
Aug 13th 2019, 09:31 |
val |
and how a table alias can be set on Query object? |
# |
Aug 13th 2019, 09:12 |
neon1024 |
`$newSubQuery = $this->Examples->find()` |
# |
Aug 13th 2019, 09:05 |
val |
@admad any example? |
# |
Aug 13th 2019, 08:51 |
admad |
Create a separate query instance for the sub query |
# |
Aug 13th 2019, 08:42 |
val |
So that the alias would be applied only to that subquery. |
# |
Aug 13th 2019, 08:41 |
val |
Hi, what is the safe way to construct a subquery with custom aliases in 3.x? |
# |
Aug 13th 2019, 07:36 |
neon1024 |
Hey @jotpe |
# |
Aug 13th 2019, 07:34 |
jotpe |
Morning all |
# |
Aug 13th 2019, 06:34 |
xuanvu442 |
@admad Thanks bro |
# |
Aug 13th 2019, 05:58 |
admad |
@xuanvu442 in cake 3 you can use `bin/cake routes` in CLI to get list of all connected routes, i don't remember if 2.x has the same command |
# |
Aug 13th 2019, 05:10 |
xuanvu442 |
Hi everyone! I’ve a small question, hope guys help me. How do I get all the HTTP Request Method available on my project (cakephp 2.x)? Plz see the image! |
# |
Aug 13th 2019, 03:18 |
challgren |
Do you have any guide you followed for using AWS? |