Logs for #cakephp

Page 6 of 36,254, showing 100 records out of 3,625,309 total, starting on record 501, ending on 600

# At Username Text
# Aug 21st, 15:30 daniel.upshaw Even overwriting the variable immediately: ```$tagRoutesPiped = (string)implode( '|', TableRegistry::getTableLocator() ->get('Tags') ->find('all') ->select(['alias']) ->where(['route' => 1]) ->all() ->extract('alias') ->toArray() ); $tagRoutesPiped = 'test';```
# Aug 21st, 15:29 daniel.upshaw @admad When the cache is removed entirely, the error happens 100% of the time on every page load
# Aug 21st, 15:28 mdotobie Thanks for the tips @admad @daniel.upshaw @alexdd55976
# Aug 21st, 15:26 daniel.upshaw So it's happening before it jumps inside the scope even
# Aug 21st, 15:26 daniel.upshaw This now comes before the `Router::scope('/', function (RouteBuilder $routes) use ($tagRoutesPiped) {`
# Aug 21st, 15:26 daniel.upshaw Here's an odd thing about the routing issue @admad ... If I use this, with no caching (presumably), it still throws the error: ```$tagRoutesPiped = (string)implode( '|', TableRegistry::getTableLocator() ->get('Tags') ->find('all') ->select(['alias']) ->where(['route' => 1]) ->all() ->extract('alias') ->toArray() );```
# Aug 21st, 15:21 mdotobie Well not stick with, but start using rather. NPM is available now on our current VPS (even though we are planning to migrate to a DigitalOcean droplet where we have more control over the toolchain)
# Aug 21st, 15:20 mdotobie So it looks like I should stick with `npm` for the management of the frontend stuff.
# Aug 21st, 15:20 admad @btx there are tons of plugins out there will you can refer to for how to test standalone plugins :slightly_smiling_face:
# Aug 21st, 15:19 mdotobie No I definitely understand the distinctions @daniel.upshaw. It just seemed when I started seeing the frontend libraries I use on packagist.org that it was a move to a single manager.
# Aug 21st, 15:17 ricksaccous i dunno, i'm just guessing that's how it works actually i don't really do TDD at the moment but our organization is slowly gravitating towards it
# Aug 21st, 15:16 ricksaccous @btx you just have to make sure your composer autoload is updated and that phpunit.xml.dist is updated as well
# Aug 21st, 15:15 daniel.upshaw But I guess I might run into the same problem
# Aug 21st, 15:15 daniel.upshaw Okay, I may have to make a custom Route to do what I need in this case
# Aug 21st, 15:14 ricksaccous hmmmm
# Aug 21st, 15:14 ricksaccous @btx you can test plugins within the main app, if it's in your plugins folder, if it's in vendor then yeah you would do it separately
# Aug 21st, 15:14 daniel.upshaw Ahh
# Aug 21st, 15:12 admad @daniel.upshaw yeah that feature is a PITA
# Aug 21st, 15:11 btx the book just directs you to regular App tests which assume cake is already installed
# Aug 21st, 15:10 btx n00b question, but how should I be properly testing plugins? create a new Cake app, drop the plugin in, and then do the tests?
# Aug 21st, 15:09 daniel.upshaw By disabling the Routing cache
# Aug 21st, 15:09 daniel.upshaw Interestingly, if I change `->add(new RoutingMiddleware($this, '_cake_routes_'));` to `->add(new RoutingMiddleware($this, null));` it works
# Aug 21st, 15:08 alexdd55976 just put the files in the right folder. more packagemanager > chances to mess stuff up
# Aug 21st, 15:07 daniel.upshaw ``` * Cache: Routes are cached to improve performance, check the RoutingMiddleware * constructor in your `src/Application.php` file to change this behavior.```
# Aug 21st, 15:07 alexdd55976 you do not want to do that.
# Aug 21st, 15:05 daniel.upshaw And `bower` is a JS dependency
# Aug 21st, 15:05 admad Don't use composer for fronted libs
# Aug 21st, 15:05 daniel.upshaw You will need to `npm install` your JavaScript dependencies
# Aug 21st, 15:05 daniel.upshaw Does that make sense?
# Aug 21st, 15:04 daniel.upshaw NPM is for JavaScript/CSS etc, Composer is for PHP
# Aug 21st, 15:04 mdotobie I know this isn’t a CakePHP-specific question but since it is my framework of choice, I figured I’d ask this here. From everything I’ve been doing, it’s possible to bring frontend libraries into my Cake project using composer. I seemed to be under the impression that it was doing its internal magic to link those frontend libraries into my `webroot` folder - but a recent bug seems to indicant that this isn’t the case. My question is
# Aug 21st, 15:04 slackebot using Composer to bring the frontend libraries into the project, do I still need to use `npm install` to get the `dist` files into the right directories? If I still need to use `npm`, what is the benefit of using Composer? Does using `npn install` actually bring them into the Cake projects `webroot` directory? It seems this functionality is dictated by some additional information in the libraries `package.json` file, which wouldn’t be specific to a
# Aug 21st, 15:04 slackebot Cake directory structure. A lot of this has me thinking I should either be using `npm` exclusively for frontend management or return to `bower`. In my original setup, I loaded frontend dependencies using `bower`, got the `dist` files in the correct `webroot` subfolders with custom paths in the `bower.json` file and then committed those frontend dependencies to the repo - effectively freezing them (this was mostly because our server doesn’t allow the
# Aug 21st, 15:04 slackebot install of `npm` and thus no `bower`. Sorry for all the questions all at once, I figured I should put everything together.
# Aug 21st, 15:04 daniel.upshaw Fair :slightly_smiling_face: Thanks for the tip
# Aug 21st, 15:04 admad Unnecessary double caching could actually be detrimental, cache reads aren't exactly free either :slightly_smiling_face:
# Aug 21st, 15:03 daniel.upshaw Seems indicative of a bug, yes?
# Aug 21st, 15:03 daniel.upshaw So strange that it only happens on the first page loa
# Aug 21st, 15:01 daniel.upshaw I just wanted it to be speedy on all fronts
# Aug 21st, 15:01 daniel.upshaw Right, I tried removing that
# Aug 21st, 15:01 admad Why cache the query when you are already caching imploded results
# Aug 21st, 15:01 daniel.upshaw If I hard code the string, it works fine
# Aug 21st, 15:00 daniel.upshaw I'm not sure if it would make a difference, but it's in my `routes.php`, so aside from potential best practices I don't see how that could make a technical difference?
# Aug 21st, 14:59 daniel.upshaw So strange
# Aug 21st, 14:58 daniel.upshaw Much cleaner without the `new Collection` though!
# Aug 21st, 14:58 daniel.upshaw Hrm, oddly this still errs: ```$tagRoutesPiped = Cache::remember('tagRoutesPiped', function () { return (string)implode( '|', TableRegistry::getTableLocator() ->get('Tags') ->find('all') ->select(['alias']) ->where(['route' => 1]) ->cache('tagRoutes') ->all() ->extract('alias')->toArray()
# Aug 21st, 14:58 slackebot ); });```
# Aug 21st, 14:57 admad so `->cache()->all()->extract()->toArray()`
# Aug 21st, 14:56 daniel.upshaw That's really cool, I did not know that
# Aug 21st, 14:56 daniel.upshaw Oh awesome!!!
# Aug 21st, 14:56 admad btw resutlsets are also collections so creating a new collection is unnecessary
# Aug 21st, 14:56 daniel.upshaw It's a great call.... though still error with both of these: ``` $tagRoutesPiped = Cache::remember('tagRoutesPiped', function () { return (string)implode( '|', (new Collection( TableRegistry::getTableLocator() ->get('Tags') ->find('all') ->select(['alias']) ->where(['route' => 1])
# Aug 21st, 14:56 slackebot ->cache('tagRoutes') ->toArray() ))->extract('alias')->toArray() ); });``` ``` $tagRoutesPiped = Cache::remember('tagRoutesPiped', function () { return (string)implode( '|', (new Collection( TableRegistry::getTableLocator() ->get('Tags') ->find('all') ->select(['alias'])
# Aug 21st, 14:56 slackebot ->where(['route' => 1]) ->toArray() ))->extract('alias')->toArray() ); });```
# Aug 21st, 14:55 admad that will cause the query to be actually run and not give you the pdo serialization error
# Aug 21st, 14:54 admad @daniel.upshaw add a `->toArray()` after `->cache()`
# Aug 21st, 14:51 daniel.upshaw Same with this, no error: ``` $tagRoutesPiped = Cache::remember('tagRoutesPiped', function () { return implode( '|', ['test', 'this', 'debug'] ); });```
# Aug 21st, 14:50 daniel.upshaw This does not show the error, if I `return 'string';`
# Aug 21st, 14:50 daniel.upshaw ``` $tagRoutesPiped = Cache::remember('tagRoutesPiped', function () { return (string)implode( '|', (new Collection( TableRegistry::getTableLocator() ->get('Tags') ->find('all') ->select(['alias']) ->where(['route' => 1]) ))->extract('alias')->toArray() ); });```
# Aug 21st, 14:45 daniel.upshaw For some reason, on the first page load with cache cleared, it is seeing a PDO instance somewhere
# Aug 21st, 14:45 daniel.upshaw It's so strange, it still does it
# Aug 21st, 14:45 daniel.upshaw I'll try force casting the `implode` result to `(string)`
# Aug 21st, 14:44 daniel.upshaw `$tagRoutesPiped` is a string
# Aug 21st, 14:44 daniel.upshaw But not on subsequent pageloads
# Aug 21st, 14:44 daniel.upshaw That error happens after a clearing `tmp/*` and refreshing
# Aug 21st, 14:44 daniel.upshaw `Error: You cannot serialize or unserialize PDO instances`
# Aug 21st, 14:43 daniel.upshaw ```$tagRoutesPiped = Cache::remember('tagRoutesPiped', function () { return implode( '|', (new Collection( TableRegistry::getTableLocator() ->get('Tags') ->find('all') ->select(['alias']) ->where(['route' => 1]) ->cache('tagRoutes') ))->extract('alias')->toArray() );
# Aug 21st, 14:43 slackebot });```
# Aug 21st, 14:43 daniel.upshaw Experiencing odd behavior with Caching
# Aug 21st, 14:24 ricksaccous admad is prob right where if you just lowered some paddings/margins in a couple places you'd be fine
# Aug 21st, 14:23 ricksaccous i dunno
# Aug 21st, 14:23 ricksaccous i would just test it from your main computer without cake if you could
# Aug 21st, 14:14 admad problem is most likely in your html not wkhtmltopdf
# Aug 21st, 14:12 scuadra this is the cakepdf configuration
# Aug 21st, 14:11 scuadra 'margin' => [ 'bottom' => 0, 'left' => 0, 'right' => 0, 'top' => 0 ]
# Aug 21st, 14:11 scuadra I set all margins to 0 :)
# Aug 21st, 14:11 scuadra yes
# Aug 21st, 14:10 ricksaccous try messing with the settings?
# Aug 21st, 14:10 ricksaccous it probably just means some setting or something to do with page space is causing your pdf to be larger than the space it takes up on the web?
# Aug 21st, 14:09 scuadra Hello. Has somebody encountered a blank page problem using CakePDF with wkhtmltopdf engine? When I export to pdf, my pdf has 2 pages but the second is absolutely empty.
# Aug 21st, 14:08 neon1024 Here are the options, which are probably on api.cakephp.org also I’d imagine
# Aug 21st, 14:08 neon1024 https://github.com/cakephp/cakephp/blob/master/src/View/Helper/FormHelper.php#L1130-L1160
# Aug 21st, 14:07 maymeow @neon1024 @ricksaccous thank you ... I tried to find title not label ..
# Aug 21st, 14:05 neon1024 `$this->Form->control('example', ['label' => 'Cats vs Dogs?']);`
# Aug 21st, 14:05 ricksaccous https://book.cakephp.org/3.0/en/views/helpers/form.html
# Aug 21st, 14:05 ricksaccous also there's a lot of reading to do on this
# Aug 21st, 14:05 ricksaccous you give it the label option
# Aug 21st, 14:03 maymeow How can I change title for form control?
# Aug 21st, 13:18 ricksaccous hahaha i'm going to try
# Aug 21st, 13:17 neon1024 If you attend Cakefest I can tell you more about it in my talk #shamelessplug
# Aug 21st, 13:17 neon1024 +1 for Vue.js
# Aug 21st, 13:13 ricksaccous i see
# Aug 21st, 13:13 admad don't have to let js takeover your whole page like the other js frameworks
# Aug 21st, 13:13 admad vuejs js is nice if you want to spice up just parts of your html page
# Aug 21st, 13:12 ricksaccous for this page i'm thinking one of those frameworks might actually make more sense, but yeah I never explored it very much to be honest
# Aug 21st, 13:12 ricksaccous i'm actually working on an intricate piece right now with a lot of logic intertwined with a lot of ajax calls via jquery
# Aug 21st, 13:11 admad i abore the js frameworks ecosystem
# Aug 21st, 13:09 ricksaccous haha yeah i pretty much only do jquery work as well, haven't touched vuejs or any js framework either
# Aug 21st, 13:08 admad i only do jquery work and have done bit of vuejs :slightly_smiling_face:
# Aug 21st, 13:00 ricksaccous @admad have you ever worked on js heavy projects? you seem to work on a ton of back end work