# |
Oct 18th 2019, 20:59 |
ricksaccous |
etc etc |
# |
Oct 18th 2019, 20:59 |
ricksaccous |
Are you sure you're using the right .ctp file |
# |
Oct 18th 2019, 20:59 |
ricksaccous |
@ron.rattie are you displaying the fetched content in the layout? are you sure your plugin is using the regular layout? Are you spitting out things in the actual .ctp file? |
# |
Oct 18th 2019, 20:21 |
ron.rattie |
Nothing, the opposite of something. Well the layout pieces I’m the default show but that’s it. I know I’m missing something basic here, but I just back to working in this today |
# |
Oct 18th 2019, 20:14 |
ricksaccous |
what do you mean by nothing shows? |
# |
Oct 18th 2019, 20:11 |
ron.rattie |
Okay so new question, I'm using the app default.ctp as the layout for the site and when I go to /audit-trail/logs nothing shows but debugkit shows the variable is there, is there something I need to put in the default.ctp to display plugin content? |
# |
Oct 18th 2019, 19:35 |
ron.rattie |
But it's the top of the routes now |
# |
Oct 18th 2019, 19:35 |
ron.rattie |
Feels odd putting the: Router::plugin( 'AuditTrails', ['path' => '/audit-trails'], function ($routes) { $routes->connect('/logs', ['controller' => 'Logs']); } ); In the main routes.php |
# |
Oct 18th 2019, 19:23 |
holisticnetworking |
Is it possible to query a Model from inside a Behavior? I need to ensure that a companion record lives in two tables in a database upon saving or updating? |
# |
Oct 18th 2019, 19:10 |
ron.rattie |
I'm getting closer I would suppose. |
# |
Oct 18th 2019, 18:56 |
daniel.upshaw |
You could try moving `Plugin::routes();` closer to the top of your app's `routes.php` before the others |
# |
Oct 18th 2019, 18:54 |
daniel.upshaw |
Yah |
# |
Oct 18th 2019, 18:54 |
ndm |
Look at route number 3 and 4, they are catch all routes, number 4 specifically will catch your URL. That's most likely in your main routes config file. |
# |
Oct 18th 2019, 18:54 |
daniel.upshaw |
I wonder if that `_controller:index` route is catching it |
# |
Oct 18th 2019, 18:53 |
daniel.upshaw |
Yeah it does look right |
# |
Oct 18th 2019, 18:52 |
daniel.upshaw |
Sorry, hmm |
# |
Oct 18th 2019, 18:52 |
daniel.upshaw |
Oh |
# |
Oct 18th 2019, 18:52 |
daniel.upshaw |
@ron.rattie Probably should be `class AuditTrailsController` |
# |
Oct 18th 2019, 18:52 |
slackebot1 |
<ron.rattie> |
# |
Oct 18th 2019, 18:52 |
ron.rattie |
Okay.. updated the routes to use scope instead of get and I see these: |
# |
Oct 18th 2019, 18:51 |
daniel.upshaw |
@ndm, looks like a handy CLI function, nice |
# |
Oct 18th 2019, 18:21 |
ndm |
You probably have other routes that are catching the URL. Use the routes shell (`bin/cake routes`) to get a list of routes in the connected order. |
# |
Oct 18th 2019, 18:18 |
slackebot1 |
'MspPivotActivityLogDetails' ] ] ); $this->set('logs', $query); } |
# |
Oct 18th 2019, 18:18 |
ron.rattie |
namespace AuditTrails\Controller; use AuditTrails\Controller\AppController; use Cake\ORM\TableRegistry; class LogsController extends AppController { public function index() { $AuditTrailsLog = TableRegistry::getTableLocator()->get('AuditTrails.MspPivotActivityLog'); $query = $AuditTrailsLog->find( 'all', [ 'contain' => [ 'MspPivotActivityLogRequest', |
# |
Oct 18th 2019, 18:18 |
ron.rattie |
My Logs controller has this: |
# |
Oct 18th 2019, 18:17 |
ron.rattie |
use Cake\Routing\RouteBuilder; use Cake\Routing\Router; use Cake\Routing\Route\DashedRoute; Router::plugin( 'AuditTrails', ['path' => '/audit-trails'], function ($routes) { $routes->get('/logs', ['controller' => 'Logs']); } ); |
# |
Oct 18th 2019, 18:16 |
ron.rattie |
This is the router for the plugin: |
# |
Oct 18th 2019, 18:16 |
ron.rattie |
Hey, I have a routing question I think. I have a plugin "Audit Trails" with a controller "Logs" with an index function. When I go to /audit-trails/logs I see "Controller class AuditTrails could not be found". |
# |
Oct 18th 2019, 16:48 |
daniel.upshaw |
I bet my routes issue is that this project uses `"cakephp/cakephp": "3.5.*"` |
# |
Oct 18th 2019, 16:19 |
neothermic |
sweet, init was the key |
# |
Oct 18th 2019, 16:18 |
daniel.upshaw |
You might have to `use` the trait in the `Table` class |
# |
Oct 18th 2019, 16:17 |
noel |
I'm trying to get friendsofcake/Search and friendsofcake/crud-json-api to work together. What isn't clear is how to make a search request? Is this documented somewhere? I'm assuming it would be GET request using a query string but I'm getting an error `Missing Search.Search behavior on App\\Model\\Table\\CocktailsTable` |
# |
Oct 18th 2019, 16:17 |
neothermic |
```This branch is for CakePHP 3.4 and newer``` |
# |
Oct 18th 2019, 16:17 |
steinkel |
https://github.com/jippi/cakephp-newrelic/tree/cake3 |
# |
Oct 18th 2019, 16:16 |
neothermic |
(I'm aware that there's a middelware for this, but that one needs cake 3.6 and PHP 7.1+... and yeah.) |
# |
Oct 18th 2019, 16:16 |
steinkel |
there's also a plugin for that I've used time ago... |
# |
Oct 18th 2019, 16:16 |
steinkel |
middleware after routing middleware would work |
# |
Oct 18th 2019, 16:16 |
steinkel |
because AppController happens now much deeper in the stack, Middleware sound like a good place for non cake stuff happening in the request |
# |
Oct 18th 2019, 16:16 |
neothermic |
I need to construct enough of a path to be able to name the transaction for newrelic |
# |
Oct 18th 2019, 16:15 |
noel |
Hi all |
# |
Oct 18th 2019, 16:14 |
steinkel |
what do you need to inject? |