Logs for #cakephp

Page 2 of 36,154, showing 100 records out of 3,615,322 total, starting on record 101, ending on 200

# At Username Text
# Jun 15th, 07:37 rightscoreanalysis I think I need this: use Cake\ORM\TableRegistry;
# Jun 15th, 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, 07:35 rightscoreanalysis still strugglng with this
# Jun 15th, 05:15 admad As for how the middleware handles various exceptions walk through the errormiddleware code it
# Jun 15th, 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, 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, 03:33 khalid but CoreException seems to by pass all that..
# Jun 15th, 03:33 khalid SPL Exceptions more or less follow the same structure of Errors
# Jun 15th, 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, 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, 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, 02:50 khalid @admad does cake have this in their documentation? Thanks for help mate
# Jun 15th, 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, 02:30 admad @khalid you need a custom exception middleware and load that instead of the core one in your Application:: bootstrap ()
# Jun 15th, 02:28 admad @stephenzgalbraith yes they have cake 4 compatible branches
# Jun 15th, 01:34 stephenzgalbraith Does anyone know if the official cakephp authentication/authorization plugins are working on the 4.x releases ?
# Jun 14th, 23:38 khalid @rightscoreanalysis yes or maybe you can paste code
# Jun 14th, 23:37 khalid @dereuromark can you check my exceptionhandler issue.. any suggestion would be highly appreciated
# Jun 14th, 23:03 rightscoreanalysis something like: use use App\Model\ListingTable ?
# Jun 14th, 22:50 ricksaccous phew
# Jun 14th, 22:50 ricksaccous hang
# Jun 14th, 22:50 ricksaccous I'm starting to get tthe hand of widgets
# Jun 14th, 22:34 dereuromark You just forgot your use statement. Use an IDE, it helps to do those things
# Jun 14th, 21:14 khalid Or with tablelocator get object of model and call its getter method
# Jun 14th, 21:13 khalid I guess you can try to load model in controller
# Jun 14th, 21:13 rightscoreanalysis it's trying to find a controller
# Jun 14th, 21:13 rightscoreanalysis the error I get is: 'App\Controller\Api\ListingTable' not found
# Jun 14th, 21:09 rightscoreanalysis but how can I reference it in a controller?
# Jun 14th, 21:09 rightscoreanalysis in another model table file I can reference the const with: ListingTable::TYPES['Sale'];
# Jun 14th, 21:08 rightscoreanalysis In my model table file I have a constant: const TYPES = ['Sale' => '1', 'Wanted' => '2'];
# Jun 14th, 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, 17:56 khalid And this error handler is a class in src/error
# Jun 14th, 17:56 khalid You mean from where I am throwing exception? That would be controller yes
# Jun 14th, 17:37 ashish_onmobile @khalid where are you throwing your exception in controller or else where
# Jun 14th, 17:04 khalid Any suggestions help would be appreciated
# Jun 14th, 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, 14:55 khalid it doesn't go to these functions.
# Jun 14th, 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, 14:55 slackebot1 _displayException($exception) { die('DIEING'); echo 'Theres has been an exception!'; } ```
# Jun 14th, 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, 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, 14:42 st.steinkuehler @scuadra This seems strange to me: `'count' => $this->find()->func()->count('*'),`
# Jun 14th, 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, 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, 14:25 yamcomnet Matching does not work properly. not consistent. Sometimes finds correctly when return $q->where(['Payments.id' => '123456']);
# Jun 14th, 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, 14:24 yamcomnet Very Strange Things happening. Cake 3.7.8.
# Jun 14th, 14:20 slackebot1 'YEAR(NewsArticles.date)' => 'DESC' ]) ->toArray();
# Jun 14th, 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([
# Jun 14th, 11:13 awi hm. I dont see there any errors
# Jun 14th, 11:02 neon1024 I tend to use `var_dump($entity->getErrors())` as I dont believe that DebutKit always displays them if they’re nested
# Jun 14th, 11:02 neon1024 They’re in the Entities errors property with a key of the table I think
# Jun 14th, 11:01 awi Does aqnyone know, where I do get model validation errors when I save associated data into BelongsToMany Table using through?
# Jun 14th, 10:37 berarma Thanks. Now I see all the options.
# Jun 14th, 10:23 steinkel @berarma there is a mailing list here https://nimb.ws/OjApmC see the bottom of the page at https://cakephp.org/
# Jun 14th, 10:18 neon1024 @berarma If you go to cakephp.org and hover over the Community menu item on the right hand side it has links to things like the forum
# Jun 14th, 10:16 berarma I'm working on an alternative to templating languages and I want to build a cakephp plugin for it. Since I work alone I'd like to have some input from anyone interested.
# Jun 14th, 10:14 berarma I'll use the forums.
# Jun 14th, 10:13 berarma Thanks @steinkel, so there's no mailing list I guess. I think there was one some time ago.
# Jun 14th, 10:11 steinkel @berarma https://cakephp.org/pages/get-involved#getHelp
# Jun 14th, 09:57 berarma OMG, I didn't know there was a forum. I wonder why I never found it on google searches. Isn't it getting indexed?
# Jun 14th, 09:42 berarma Hi. Does CakePHP have a mailling list?
# Jun 14th, 09:33 neon1024 Oh I see, didn’t realise, sorry
# Jun 14th, 09:33 acosonic I'm still on 2 :slightly_smiling_face: but I guess I'll find it
# Jun 14th, 09:33 neon1024 What is not working in that for you?
# Jun 14th, 09:33 neon1024 https://book.cakephp.org/3.0/en/core-libraries/email.html#setting-headers
# Jun 14th, 09:32 acosonic I figured that one, now trying to add list-unsubscribe...
# Jun 14th, 09:32 acosonic @neon1024 yeah both worked
# Jun 14th, 09:30 neon1024 @acosonic I think with the Cake Email class you can use `$Email->emailFormat('both')`
# Jun 14th, 09:26 acosonic somehow
# Jun 14th, 09:26 acosonic also... header(array('List-Unsubscribe' => $url)) I need that
# Jun 14th, 09:04 scuadra @admad thank you
# Jun 14th, 08:58 acosonic hm....
# Jun 14th, 08:58 acosonic https://stackoverflow.com/questions/11565136/cakeemail-send-html-and-plain-text-message-manually
# Jun 14th, 08:56 acosonic https://wiki.apache.org/spamassassin/Rules/MIME_HTML_ONLY
# Jun 14th, 08:55 acosonic but it complains about only html email...
# Jun 14th, 08:55 acosonic https://www.mail-tester.com
# Jun 14th, 08:54 acosonic I'm just trying to get good score on
# Jun 14th, 08:54 acosonic hi everyone, how do I send email both html and text... ?
# Jun 14th, 08:42 dereuromark Also if you cant fuck up things on prod :slightly_smiling_face: I wouldnt do it for API things for example. If you forget to set local stuff you might delete/modify via live API
# Jun 14th, 08:42 dereuromark Joe: for non sensible data yes
# Jun 14th, 08:40 admad @scuadra it probably doesnt like empty image name. I suggest you use name for a 1x1px tranparent png instead
# Jun 14th, 08:36 kgb.acct.personal So, I write prod config in `app.php` then I write dev config in `.env`?
# Jun 14th, 08:35 scuadra Hello. In Cake 3.7 I get the following notice: Uninitialized string offset: 0 [CORE/src/View/Helper/UrlHelper.php, line 178]. This is the assetUrl() method. However the warning comes from the image() method in this Helper. What I am trying to do is to use jquery lazyload for images because they are too much and the error probably comes because I use the Html image helper like that: $this->Html->image('', ['class' => 'lazyload card-img',
# Jun 14th, 08:35 slackebot1 'data-src' => '/cache/images/products/...whatever']). The first argument is empty and the lazyload get the img src from the data-src attribute. My question is whether is possible to avoid that warning?
# Jun 14th, 08:34 dereuromark not the other way around, ever.. ^^
# Jun 14th, 08:34 dereuromark like debug mode off - that should be the default, and locally you enable it
# Jun 14th, 08:34 kgb.acct.personal Putting in `app.php` looks promising
# Jun 14th, 08:34 dereuromark that often simplifies things and keeps mistakes in prod away
# Jun 14th, 08:34 dereuromark they "can" default to prod if you wanted to and only overwrite locally and for tests
# Jun 14th, 08:33 dereuromark for me they would also be ENV then
# Jun 14th, 08:32 kgb.acct.personal Application-wide constants, not sure where to put them
# Jun 14th, 08:31 dereuromark what kind of extra configs? They are either persisted (no pwds, keys, etc) or defaulted to nothing and read from ENV where needed.
# Jun 14th, 08:28 admad why not in app.php itself?
# Jun 14th, 08:28 kgb.acct.personal So, where do I put extra configs? bootstrap.php?
# Jun 14th, 08:27 admad bingo!
# Jun 14th, 08:27 kgb.acct.personal Ah. I see, it's just for emulating environment variables
# Jun 14th, 08:24 dereuromark why not using actual ENV to inject here?
# Jun 14th, 08:23 kgb.acct.personal Because on `env.default` states: ``` # Having this file in production is considered a **SECURITY RISK** and also decreases # the boostrap performance of your application. ```
# Jun 14th, 08:23 kgb.acct.personal Is it safe to use `.env` on prod?