# |
Feb 19th 2020, 07:32 |
admad |
> can I force the Entity to use Chronos for all datetime That's already by the ORM for actual db fields |
# |
Feb 19th 2020, 07:20 |
turkles |
Hi all, I'm trying to create a virtual field which relies on if a datetime is in the past, can I force the Entity to use Chronos for all datetime? Or do I have to create a Chronos instance? Or should I just be using somethign to compare the FrozenTime it already uses (this is cake 3.8) |
# |
Feb 18th 2020, 23:59 |
rightscoreanalysis |
I solved it - thanks :) |
# |
Feb 18th 2020, 23:52 |
rightscoreanalysis |
namespace App\Controller\Admin; |
# |
Feb 18th 2020, 23:51 |
challgren |
And if your namespace on the PurchaseController correct |
# |
Feb 18th 2020, 23:51 |
rightscoreanalysis |
I have admin routes set up |
# |
Feb 18th 2020, 23:51 |
challgren |
Is your controller in /src/Controller/Admin/PurchasesController |
# |
Feb 18th 2020, 23:51 |
rightscoreanalysis |
but buyer in this case is a param not action |
# |
Feb 18th 2020, 23:51 |
rightscoreanalysis |
I am getting an error: Action PurchasesController::buyer() could not be found |
# |
Feb 18th 2020, 23:50 |
rightscoreanalysis |
admin/purchases/buyer |
# |
Feb 18th 2020, 23:50 |
rightscoreanalysis |
on another note I have this url: |
# |
Feb 18th 2020, 23:48 |
challgren |
you could try curl verbose to see if its redirecting correctly |
# |
Feb 18th 2020, 23:47 |
rightscoreanalysis |
I am not auth'd so should be redirected to login |
# |
Feb 18th 2020, 23:47 |
rightscoreanalysis |
sorry - login |
# |
Feb 18th 2020, 23:47 |
rightscoreanalysis |
logout |
# |
Feb 18th 2020, 23:46 |
challgren |
login or out? |
# |
Feb 18th 2020, 23:45 |
rightscoreanalysis |
I tried an incognito browser sesssion and still not redirected to the correct logout url |
# |
Feb 18th 2020, 23:36 |
challgren |
@dereuromark cant sleep? |
# |
Feb 18th 2020, 23:29 |
rightscoreanalysis |
ok will try - btw I had plugin in my array alreafy, I switched that out for prefix - didn't think to try them both! |
# |
Feb 18th 2020, 23:28 |
challgren |
your redirect maybe cached in your browser |
# |
Feb 18th 2020, 23:28 |
rightscoreanalysis |
hi @dereuromark btw |
# |
Feb 18th 2020, 23:28 |
rightscoreanalysis |
but still redirected to admin/ |
# |
Feb 18th 2020, 23:27 |
slackebot |
<rightscoreanalysis> |
# |
Feb 18th 2020, 23:27 |
rightscoreanalysis |
so my array is now |
# |
Feb 18th 2020, 23:21 |
dereuromark |
@rightscoreanalysis https://github.com/dereuromark/cakephp-tools/blob/master/src/View/Helper/UrlHelper.php#L86 is the reason I use such helper methods a lot inside layouts as well. in your case you need it for the Auth config array URLs. |
# |
Feb 18th 2020, 23:20 |
MrEm |
Well, I think my perspective is less about finding a trick, but more about thinking of collections as a whole - rather than a sum of parts, i fthat makes sense |
# |
Feb 18th 2020, 23:20 |
dereuromark |
alan-a: always set up your login routes with proper defaults. |
# |
Feb 18th 2020, 23:20 |
rightscoreanalysis |
admin/user/login is not found |
# |
Feb 18th 2020, 23:19 |
rightscoreanalysis |
when I try to access a route which I do not have access to: /admin/users/index my app attempts to redirect to login, but it goes to admin/users/login - not users/login |
# |
Feb 18th 2020, 23:19 |
dereuromark |
Any Hash or collection trick would do the same, but it might not be worth trying to find those until they work as expected. |
# |
Feb 18th 2020, 23:18 |
dereuromark |
or other helper methods somewhere. dont be afraid of some loops, as long as they are wrapped inside a method cleanly. |
# |
Feb 18th 2020, 23:17 |
MrEm |
Yeah, I think that would make sense |
# |
Feb 18th 2020, 23:14 |
dereuromark |
loaded = contained |
# |
Feb 18th 2020, 23:14 |
dereuromark |
I throw an exception if the events havent been loaded (developer error, if null) |
# |
Feb 18th 2020, 23:13 |
MrEm |
Hm, that's a possibility |
# |
Feb 18th 2020, 23:11 |
dereuromark |
->events() etc here |
# |
Feb 18th 2020, 23:10 |
dereuromark |
you can always write small methods on the entity to fetch sub parts the way you want them. |
# |
Feb 18th 2020, 23:08 |
MrEm |
Or do I have to foreach ($reservations as $reservation) { $events []= $reservation->events |
# |
Feb 18th 2020, 23:08 |
MrEm |
Then can I do something like $reservations->events |
# |
Feb 18th 2020, 23:08 |
MrEm |
So: $reservations = $this->Reservations->find('all' .... |
# |
Feb 18th 2020, 23:07 |
MrEm |
Like if I do a find('all') on, say Reservations, and with Reservations I "contain" Events (which are associated) |