# |
Jun 15th 2019, 19:35 |
joey.mukherjee |
when I do a form submit with csrf middleware I can get it to work the first time, but after an ajax request which changes the contents of the form, I get a _Token not found error. anyone have any ideas? |
# |
Jun 15th 2019, 08:27 |
admad |
@rightscoreanalysis you need to "use" the listingtable class, not TableRegistry |
# |
Jun 15th 2019, 07:37 |
rightscoreanalysis |
I think I need this: use Cake\ORM\TableRegistry; |
# |
Jun 15th 2019, 07:35 |
rightscoreanalysis |
In my model table file I have a constant: const TYPES = ['Sale' => '1', 'Wanted' => '2']; in another model table file I can reference the const with: ListingTable::TYPES['Sale']; but how can I reference it in a controller? the error I get is: 'App\Controller\Api\ListingTable' not found it's trying to find a controller |
# |
Jun 15th 2019, 07:35 |
rightscoreanalysis |
still strugglng with this |
# |
Jun 15th 2019, 05:15 |
admad |
As for how the middleware handles various exceptions walk through the errormiddleware code it |
# |
Jun 15th 2019, 05:14 |
admad |
@khalid don't understand what $next does read up about PSR-7 double pass middlewares. It's a general standard from the PHP-FIG group |
# |
Jun 15th 2019, 03:34 |
khalid |
what I want is one place where I have Exception object which I can use to do post exception tasks. |
# |
Jun 15th 2019, 03:33 |
khalid |
but CoreException seems to by pass all that.. |
# |
Jun 15th 2019, 03:33 |
khalid |
SPL Exceptions more or less follow the same structure of Errors |
# |
Jun 15th 2019, 03:33 |
khalid |
my question is: where and how it decide it how it needs to treat Core Exception differently than errors or spl exceptions |
# |
Jun 15th 2019, 03:32 |
khalid |
in error middleware what does this do? return $next($request, $response); I checked next its an object and its as far as I can notice its same for both error and exception but in case of Error it goes to Throwable, but in case of Exception it goes to Core Exception class constructor |
# |
Jun 15th 2019, 03:05 |
joey.mukherjee |
In case someone else has the same problem with the "Fatal error: Class 'App\Shell\Task\QueueTask' not found" error - the documentation is wrong. The Task needs to go into /src/Shell/Task/Queue and not /src/Shell/Task/ as the documentation says |
# |
Jun 15th 2019, 02:50 |
khalid |
@admad does cake have this in their documentation? Thanks for help mate |
# |
Jun 15th 2019, 02:30 |
joey |
I am getting this error when trying to use the queue plugin. I think I am missing a use line, but I have it! Any ideas? This is the error: Fatal error: Class 'App\Shell\Task\QueueTask' not found |
# |
Jun 15th 2019, 02:30 |
admad |
@khalid you need a custom exception middleware and load that instead of the core one in your Application:: bootstrap () |
# |
Jun 15th 2019, 02:28 |
admad |
@stephenzgalbraith yes they have cake 4 compatible branches |
# |
Jun 15th 2019, 01:34 |
stephenzgalbraith |
Does anyone know if the official cakephp authentication/authorization plugins are working on the 4.x releases ? |
# |
Jun 14th 2019, 23:38 |
khalid |
@rightscoreanalysis yes or maybe you can paste code |
# |
Jun 14th 2019, 23:37 |
khalid |
@dereuromark can you check my exceptionhandler issue.. any suggestion would be highly appreciated |
# |
Jun 14th 2019, 23:03 |
rightscoreanalysis |
something like: use use App\Model\ListingTable ? |
# |
Jun 14th 2019, 22:50 |
ricksaccous |
phew |
# |
Jun 14th 2019, 22:50 |
ricksaccous |
hang |
# |
Jun 14th 2019, 22:50 |
ricksaccous |
I'm starting to get tthe hand of widgets |
# |
Jun 14th 2019, 22:34 |
dereuromark |
You just forgot your use statement. Use an IDE, it helps to do those things |
# |
Jun 14th 2019, 21:14 |
khalid |
Or with tablelocator get object of model and call its getter method |
# |
Jun 14th 2019, 21:13 |
khalid |
I guess you can try to load model in controller |
# |
Jun 14th 2019, 21:13 |
rightscoreanalysis |
it's trying to find a controller |
# |
Jun 14th 2019, 21:13 |
rightscoreanalysis |
the error I get is: 'App\Controller\Api\ListingTable' not found |
# |
Jun 14th 2019, 21:09 |
rightscoreanalysis |
but how can I reference it in a controller? |
# |
Jun 14th 2019, 21:09 |
rightscoreanalysis |
in another model table file I can reference the const with: ListingTable::TYPES['Sale']; |
# |
Jun 14th 2019, 21:08 |
rightscoreanalysis |
In my model table file I have a constant: const TYPES = ['Sale' => '1', 'Wanted' => '2']; |
# |
Jun 14th 2019, 18:01 |
fr3nch13 |
How I do it is I always keep server specific settings, and account settings like the api username/password/keys in the .env file, then use the env() function in the app.php. I use the .gitignore to keep the .env out of the git repo, and include the app.php in the repo. Example in app.php Configure::write([ ‘App’ => [ ‘Name’ => env(‘APP_NAME’, ‘default if not set’) ] ]); |
# |
Jun 14th 2019, 17:56 |
khalid |
And this error handler is a class in src/error |
# |
Jun 14th 2019, 17:56 |
khalid |
You mean from where I am throwing exception? That would be controller yes |
# |
Jun 14th 2019, 17:37 |
ashish_onmobile |
@khalid where are you throwing your exception in controller or else where |
# |
Jun 14th 2019, 17:04 |
khalid |
Any suggestions help would be appreciated |
# |
Jun 14th 2019, 17:04 |
khalid |
I even tried core error handler someone exceptions dont go to their display function too it goes upto constructor but not after |
# |
Jun 14th 2019, 14:55 |
khalid |
it doesn't go to these functions. |
# |
Jun 14th 2019, 14:55 |
slackebot1 |
_displayException($exception) { die('DIEING'); echo 'Theres has been an exception!'; } ``` |
# |
Jun 14th 2019, 14:55 |
khalid |
@admad Thanks for your reply, but I also tried it, but it doesn't seem to work or I am missing something so what I did was following. In bootstrap added my CustomErrorHandler and called register method (like it said in documentation). and in my CustomErrorHandler I have following ```public function _displayError($error, $debug) { die('DIEING'); echo 'There has been an error!'; } public function |