Logs for #cakephp

Page 8 of 36,922, showing 100 records out of 3,692,143 total, starting on record 701, ending on 800

# At Username Text
# Jul 18th 2021, 20:26 kevin.pfeifer well you should get used to it ;)
# Jul 18th 2021, 20:26 kevin.pfeifer `chmod +w -R /var/www/clients/client2/web2/web/tmp/`
# Jul 18th 2021, 20:25 kevin.pfeifer well you tmp directory doesn't seem to be writeable
# Jul 18th 2021, 20:13 kevin.pfeifer to test it you can just add `$this->Authorization->skipAuthorization();` at the start of the function you want to test
# Jul 18th 2021, 20:04 kevin.pfeifer leave everything else just like https://github.com/cakephp/app/blob/master/config/routes.php#L58 so basically you only have `$builder->fallbacks();` in there
# Jul 18th 2021, 20:04 kevin.pfeifer remove/comment out both ```$builder->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']); $builder->connect('/pages/*', 'Pages::display');``` the fact that you have a pages table remove that default functionality After that you should be able to go to ```/pages => index function /pages/add => add function /pages/edit/<ID> => edit function /pages/view/<ID> => view function /pages/delete/<ID> => delete
# Jul 18th 2021, 20:04 slackebot2 function```
# Jul 18th 2021, 19:55 kevin.pfeifer index => table of all present entries view => detail view of one entry add => form to add an entry edit => form to edit an entry delete => just functionality to delete a function These functions are auto-generated from the bake CLI tool inside your controller
# Jul 18th 2021, 19:53 kevin.pfeifer the display method is only used in the Pages Controller for "static" page-templates which are set in the `templates/pages` directory What you want is the index function if you want a table of all present entries for the `pages` table (exactly what the bake CLI tool auto-generates for you)
# Jul 18th 2021, 19:41 kevin.pfeifer if you call that url normally at least GET should be in there
# Jul 18th 2021, 19:41 kevin.pfeifer not the functions in your controllers
# Jul 18th 2021, 19:41 kevin.pfeifer `$this->request->allowMethod` should have one of the HTTP Methods like GET, POST, PUT, DELETE etc.
# Jul 18th 2021, 19:28 kevin.pfeifer well what url are you calling when that error occurs
# Jul 18th 2021, 19:27 kevin.pfeifer or do you actually have a table called `pages` where you want to show entries like any other table?
# Jul 18th 2021, 19:20 kevin.pfeifer usually `/pages/*` is routed to the display function of the Display Controller https://github.com/cakephp/app/blob/master/config/routes.php#L58 Is that still the way how you have pages implemented in your code?
# Jul 18th 2021, 16:15 cnizzardini Now this really depends on your application if this is even possible. Seems best for APIs.
# Jul 18th 2021, 16:15 cnizzardini ^ Next time I need to rewrite something I am trying this approach.
# Jul 18th 2021, 16:14 cnizzardini https://martinfowler.com/bliki/StranglerFigApplication.html
# Jul 18th 2021, 11:08 kevin.pfeifer expecting that your database structure follows the cakephp naming schema
# Jul 18th 2021, 11:08 kevin.pfeifer I would start a new one, use the `bin/cake bake` tool as much as possible to auto-generate the code which can be derived from the table and column names and copy-paste the custom code (where you probably have to adjust a bit more)
# Jul 18th 2021, 11:02 vikas *Suggestions*: Will it be advisable to upgrade a legacy cake2 application to cake4 or completely rewrite the whole stuff??
# Jul 18th 2021, 08:25 hmic the default pathPrefix is files/
# Jul 18th 2021, 08:25 hmic lzz: https://book.cakephp.org/4/en/views/helpers/html.html#linking-to-videos-and-audio-files
# Jul 18th 2021, 07:08 lzz Where/What folder should I create for video? $this->Html->media()? I tried media and files inside webroot but I get 404 for both of them.
# Jul 17th 2021, 21:54 alamnaryab thank you @kevin.pfeifer this worked
# Jul 17th 2021, 21:41 kevin.pfeifer you need to pass that variable inside that anonymous function via `use` https://www.php.net/manual/en/functions.anonymous.php ```$s_id = 1; $school_classes = $this->SchoolClasses->find() ->where(['SchoolClasses.status'=>1]) ->order(['SchoolClasses.sort'=>'asc']) ->contain([ 'FeeRates'=>function($q) use ($s_id){ return $q
# Jul 17th 2021, 21:41 slackebot2 ->where(['FeeRates.status'=>1,'FeeRates.academic_session_id'=> $s_id ]) ->order(['FeeRates.sort'=>'asc']); } ]) ->all();```
# Jul 17th 2021, 21:27 alamnaryab I want to make condition on inside `contain` but external variable is not accessable ```$s_id = 1; /**** this variable is not accessable inside contain */ $school_classes = $this->SchoolClasses->find() ->where(['SchoolClasses.status'=>1]) ->order(['SchoolClasses.sort'=>'asc']) ->contain([ 'FeeRates'=>function($q){ return $q
# Jul 17th 2021, 21:27 slackebot2 ->where(['FeeRates.status'=>1,'FeeRates.academic_session_id'=> $s_id ]) ->order(['FeeRates.sort'=>'asc']); } ]) ->all();``` How can I do it. or any other alternate.
# Jul 17th 2021, 21:22 alamnaryab Hi frinds
# Jul 17th 2021, 13:15 kevin.pfeifer I know that tables !== complexity of the project but still its something countable :)
# Jul 17th 2021, 13:14 kevin.pfeifer how many tables?
# Jul 17th 2021, 13:01 neothermic (I honestly sometimes ponder if it's the largest cake2 project in production..)
# Jul 17th 2021, 12:54 kevin.pfeifer well then good luck :)
# Jul 17th 2021, 12:53 neothermic it is an eventual goal to upgrade the work stuff to 7.4, but since works' codebase is a frigging gigantic cakephp2 project, that's not quick :P
# Jul 17th 2021, 12:52 neothermic I should really create a new VM to match my personal stuff, as that's on 7.2 at least..
# Jul 17th 2021, 12:51 kevin.pfeifer ah^^
# Jul 17th 2021, 12:51 neothermic my local vagrant is also my work replication setup, and that's still on 7.1, so can't run 4.x :)
# Jul 17th 2021, 12:51 kevin.pfeifer anyway, is there a specific reason why you start with 3.8 instead of 4.2?
# Jul 17th 2021, 12:46 kevin.pfeifer mhmm ok
# Jul 17th 2021, 12:46 kevin.pfeifer I have no experience with vagrant ,:) I can only tell you that for me in my linux machine with the same composer version it works
# Jul 17th 2021, 12:46 neothermic weird, this must be some form of race condition
# Jul 17th 2021, 12:46 neothermic yeah, that worked
# Jul 17th 2021, 12:45 neothermic so I can try installing in, say, /home instead
# Jul 17th 2021, 12:45 neothermic maybe this is a bug in vagrant's shared file systems
# Jul 17th 2021, 12:45 neothermic lemme try one thing
# Jul 17th 2021, 12:43 neothermic I've checked the cache file it's downloaded and the file is there and all looks good
# Jul 17th 2021, 12:43 neothermic it's like the extract takes longer than it expects it to, so it's checking too soon
# Jul 17th 2021, 12:43 neothermic nothing looks odd with -vvv, other than the failure generally
# Jul 17th 2021, 12:41 kevin.pfeifer try with `-vvv` and see if you can spot something odd
# Jul 17th 2021, 12:40 neothermic 1.1T left, directory is fully RW just to be sure
# Jul 17th 2021, 12:40 kevin.pfeifer and I guess you have already checked the basics like write permissions of the folder and enough disk space
# Jul 17th 2021, 12:38 kevin.pfeifer you tried to add `-v` (or more v) for vebose output
# Jul 17th 2021, 12:38 kevin.pfeifer mhmm, same for me
# Jul 17th 2021, 12:38 neothermic Composer version 2.1.3 2021-06-09 16:31:20
# Jul 17th 2021, 12:37 neothermic nah, latest 2
# Jul 17th 2021, 12:37 neothermic hmm, did a composer clear-cache and tried again... and still failed
# Jul 17th 2021, 12:37 kevin.pfeifer are you using composer 1?
# Jul 17th 2021, 12:34 neothermic happens every time here ¬_¬
# Jul 17th 2021, 12:30 kevin.pfeifer no problem here for me. Neither with composer 1 nor composer 2
# Jul 17th 2021, 12:24 neothermic so, trying to do a fresh cake3 install, it seems to be unhappy with execution: I ran: ```composer create-project --prefer-dist cakephp/app:^3.8 SomeProject``` It chugged through, but `cakephp/plugin-installer` fails every time: ``` - Installing cakephp/plugin-installer (1.3.1): Extracting archive Plugin initialization failed (include(/vagrant/SomeProject/vendor/cakephp/plugin-installer/src/Plugin.php): failed to open stream:
# Jul 17th 2021, 12:24 slackebot2 No such file or directory), uninstalling plugin - Removing cakephp/plugin-installer (1.3.1) Install of cakephp/plugin-installer failed [RuntimeException] Could not delete /vagrant/SomeProject/vendor/cakephp/plugin-installer/src:``` I can see the fact that Plugin.php exists where it says it thinks it's not, so unsure why, but basically I can't progress (and cd-ing into the project directory and running composer install fails in
# Jul 17th 2021, 12:24 slackebot2 the same way)
# Jul 17th 2021, 12:00 kevin.pfeifer you can also set `stopOnFailure="true"` in your phpunit.xml
# Jul 16th 2021, 21:47 greg138 One of your tests (or the code that it tests) is throwing an unexpected exception. phunit should give you the stack track of where that's happening.
# Jul 16th 2021, 19:06 sebastiansperandio093 I achieved to send a 201 response to the API which is notifying me and after of that response, I can continuw with my work inside the same method... ```public function mpNotification()     {         $this->response = $this->response->withStatus(201);         $this->response->send();         $this->autoRender = false;         $mpUrlNotif =
# Jul 16th 2021, 19:06 slackebot2 $this->request->getQueryParams('params');         $this->loadModel('Users');         $userAdmin = $this->Users->get(1);         MercadoPago\SDK::setAccessToken($userAdmin->mp_access_token);         $payment1 = MercadoPago\Payment::find_by_id($mpUrlNotif['id']);         debug($payment1); exit;     }``` this code is sending a 201 response and is showing the debug too
# Jul 16th 2021, 19:03 sebastiansperandio093 fixed
# Jul 16th 2021, 18:59 tyler.adam.lazenby it just timed out
# Jul 16th 2021, 18:59 kevin.pfeifer what, that phpunit doesn't fail even if there are error?
# Jul 16th 2021, 18:56 tyler.adam.lazenby is that normal
# Jul 16th 2021, 18:56 tyler.adam.lazenby hmmmm but the command is still running
# Jul 16th 2021, 18:56 tyler.adam.lazenby now I see
# Jul 16th 2021, 18:56 tyler.adam.lazenby oh ok
# Jul 16th 2021, 18:54 tyler.adam.lazenby what the heck is that mess
# Jul 16th 2021, 18:54 kevin.pfeifer well ,:)
# Jul 16th 2021, 18:53 tyler.adam.lazenby ```C:\xampp\htdocs\ezBusinessManager>composer run test > phpunit --colors=always PHPUnit 9.5.6 by Sebastian Bergmann and contributors. Runtime: PHP 8.0.3 Configuration: C:\xampp\htdocs\ezBusinessManager\phpunit.xml EREIIIE### hello world ### RRRRRRRRRRRRRRRIIEEEEEEIIIIIIIIIIIIIIIIIIIIIIIIIEEEEEWEE 63 / 421 ( 14%) EEERRRRRRRRRRRRRRREEEEREEEWWWWWWWE```
# Jul 16th 2021, 18:53 tyler.adam.lazenby what the...
# Jul 16th 2021, 18:51 tyler.adam.lazenby I am doing this more to make sure that the unit tests are forced into our pipeline since more developers will be coming down
# Jul 16th 2021, 18:50 tyler.adam.lazenby Yes and no
# Jul 16th 2021, 18:45 kevin.pfeifer seems like we both miss-understood the 201 location definition https://stackoverflow.com/questions/4584728/redirecting-with-a-201-created
# Jul 16th 2021, 18:38 sebastiansperandio093 thanks for answered
# Jul 16th 2021, 18:37 kevin.pfeifer but your phpunit tests work without it being executed by the gitlab CLI tool?
# Jul 16th 2021, 18:37 tyler.adam.lazenby I am just trying to create a gitlab CI that will run the unit tests, and run the phpstan script
# Jul 16th 2021, 18:36 kevin.pfeifer oh sorry, 201 should actually do that, didn't know that
# Jul 16th 2021, 18:35 kevin.pfeifer @sebastiansperandio093 a 201 is not a HTTP repsonse which redirects automatically If you just update the location header the Browser wont just go to that location as far as I know You will have to implement some JS logic which checks that location header and then redirects to that
# Jul 16th 2021, 18:34 kevin.pfeifer what "pipelines" are you running here?
# Jul 16th 2021, 18:32 tyler.adam.lazenby I had to run the configuration generator first
# Jul 16th 2021, 18:28 tyler.adam.lazenby I am wondering if I need to alter it to allow stack tracing
# Jul 16th 2021, 18:28 tyler.adam.lazenby I literally looked at my code and line 98 is just exception thrower
# Jul 16th 2021, 18:27 tyler.adam.lazenby I know! that is why I am so confused
# Jul 16th 2021, 18:21 sebastiansperandio093 is it possible? What I am wrong?
# Jul 16th 2021, 18:20 slackebot2 $this->request->getQueryParams('params'); $locationRedirect = 'http://localhost:5005/mp-payments/notification-handler?topic='.$mpUrlNotif['topic'].'andid='.$mpUrlNotif['id']; $this->response = $this->response->withStatus(201); $response = $this->response->withHeader('Location', $locationRedirect ); return $response; } public function notificationHandler() {   $mpUrlNotif = $this->request->getQueryParams('params');  
# Jul 16th 2021, 18:20 slackebot2 debug($mpUrlNotif);exit; }``` I can see the response with status 201 and the location updated, but it is not redirecting to notification-handler method
# Jul 16th 2021, 18:20 sebastiansperandio093 hello everyone!! Can someone help me with this simple issue: This is the URL where an API that I'm using is trying send notifications: http://localhost:5005/mp-payments/mp_notifications?topic=paymentandid=1238697171 I'm triying to create a response 201 and after redirect to another method of a controller class using location header: ```public function mpNotifications() {   $mpUrlNotif =
# Jul 16th 2021, 18:17 kevin.pfeifer there is no - at that line here https://github.com/sebastianbergmann/phpunit/blob/9.5/src/TextUI/Command.php#L98
# Jul 16th 2021, 18:16 tyler.adam.lazenby `"phpunit/phpunit": "^9.0",`
# Jul 16th 2021, 18:15 tyler.adam.lazenby I am on phpunit 9.5.6
# Jul 16th 2021, 18:15 kevin.pfeifer and which php version are you running it with?
# Jul 16th 2021, 18:15 kevin.pfeifer PHPUnit 8.5 i guess