# |
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 |
# |
Jun 14th 2019, 14:45 |
st.steinkuehler |
@scuadra Have you check the SQL-Log in Debug Kit? Most of the times this helps to check which SQL the ORM has generated for the database |
# |
Jun 14th 2019, 14:43 |
admad |
@khalid exception renderer only handles rendering of error responses. For your use case you use use custom error handler and/or custom exception middleware |
# |
Jun 14th 2019, 14:42 |
st.steinkuehler |
@scuadra This seems strange to me: `'count' => $this->find()->func()->count('*'),` |
# |
Jun 14th 2019, 14:36 |
khalid |
According to my understand it should go to CustomExceptionRenderer, where as for Errors its working fine, it goes to CustomExceptionRenderer but not for Exceptions. what I want is to Perform some actions on each Exception (SPL,Cake or Custom) like saving in database, sending email or something like this |
# |
Jun 14th 2019, 14:33 |
khalid |
H Guys I have generated a CustomExceptionRenderer, registered it in config/app.php, now when I am throwing an exception it is not going to Renderer but it goes to Core BaseErrorHandler and from there it set renderer and now sure what happen next. |
# |
Jun 14th 2019, 14:25 |
yamcomnet |
Matching does not work properly. not consistent. Sometimes finds correctly when return $q->where(['Payments.id' => '123456']); |
# |
Jun 14th 2019, 14:24 |
yamcomnet |
#Works Fine $p = $this->Entries->Payments->find() ->where(['type' => 'top-up']) ->limit(3) ->toArray() ; debug($p); #Does not Find Anything?? $test = $this->Entries->find('all',['contain' => ['Payments']]) ->limit(3); $testi = $test->matching('Payments', function($q){ return $q->where(['Payments.type' => 'top-up']); }); |
# |
Jun 14th 2019, 14:24 |
yamcomnet |
Very Strange Things happening. Cake 3.7.8. |
# |
Jun 14th 2019, 14:20 |
slackebot1 |
'YEAR(NewsArticles.date)' => 'DESC' ]) ->toArray(); |
# |
Jun 14th 2019, 14:20 |
scuadra |
How can I select an year from date in Cake 3. I have news_articles table and I want to find the number of articles for each year. I am doing the following: $this->find('all') ->select([ 'count' => $this->find()->func()->count('*'), 'YEAR(NewsArticles.date)' ]) ->where([ 'NewsArticles.date <=' => date('Y-m-d') ]) ->group('YEAR(NewsArticles.date)') ->order([ |