# |
Jun 2nd 2021, 15:50 |
duchdamian |
thanks for your help, have a good day! |
# |
Jun 2nd 2021, 15:49 |
slackebot |
'/var/www/html/src'` |
# |
Jun 2nd 2021, 15:49 |
duchdamian |
oh I see what's up, so the --config it's pulling into rector is actually a php file and not a yaml file, the following command worked if I point it to the yaml directly. It's an issue with the upgrade tool I believe `/cake_upgrade/vendor/bin/rector process --autoload-file='/var/www/html/vendor/autoload.php' *--config='/cake_upgrade/vendor/rector/rector/config/set/cakephp/cakephp40.yaml'* --working-dir='/var/www/html/src' |
# |
Jun 2nd 2021, 15:47 |
kevin.pfeifer |
yea, i mean just skip rector |
# |
Jun 2nd 2021, 15:47 |
duchdamian |
that error comes from rector not cake and I do have all logging enabled |
# |
Jun 2nd 2021, 15:46 |
kevin.pfeifer |
@duchdamian I have heard of many times where the rector upgrade tool was pretty finicky to setup I would just perform the "pure" composer update, set the ```'Error' => [ 'errorLevel' => E_ALL, ]``` and go from one error to the next |
# |
Jun 2nd 2021, 15:44 |
duchdamian |
CakePHP upgrade tool (master) https://github.com/cakephp/upgrade CakePHP skeleton app (3.x) https://github.com/cakephp/app/tree/3.x Followed the 4.0 upgrade guide (https://book.cakephp.org/4/en/appendices/4-0-upgrade-guide.html) |
# |
Jun 2nd 2021, 15:43 |
kevin.pfeifer |
https://github.com/FriendsOfCake/awesome-cakephp#auditing--logging |
# |
Jun 2nd 2021, 15:42 |
slackebot |
~tell iquana about awesome |
# |
Jun 2nd 2021, 15:42 |
slackebot |
Command sent from Slack by kevin.pfeifer: |
# |
Jun 2nd 2021, 15:39 |
thomas078 |
need to do audit trail tool. Is there a proper plugin or just to write myself? |
# |
Jun 2nd 2021, 15:12 |
slackebot |
'/var/www/html/src' [ERROR] Mapping values are not allowed in multi-line blocks in "/cake_upgrade/config/rector/cakephp40.php" at line 1 (near "<?php"). Rector applied successfully``` |
# |
Jun 2nd 2021, 15:12 |
slackebot |
bin/cake upgrade rector --rules cakephp40 /var/www/html/src -v Detecting autoload file for /var/www/html/src -> Checking /var/www/html/src/vendor/autoload.php -> Checking /var/www/html/vendor/autoload.php -> Found /var/www/html/vendor/autoload.php Running /cake_upgrade/vendor/bin/rector process --autoload-file='/var/www/html/vendor/autoload.php' --config='/cake_upgrade/config/rector/cakephp40.php' --working-dir='/var/www/html/src' |
# |
Jun 2nd 2021, 15:12 |
duchdamian |
Hi everyone - I'm in beginning stages of converting an app from cake 3.x to 4.x and the cake upgrade tool (rector) returns an error what sounds to me like a yaml parsing error. I'm not sure if that's a right place to post this but if someone ran into this before or knows what the issue might be I could really use some help. Also getting the exact same results against 3.9 skeleton app. CLI running PHP 7.4 ```bash-5.0# |
# |
Jun 2nd 2021, 15:10 |
ndm |
https://book.cakephp.org/4/en/orm/retrieving-data-and-resultsets.html#custom-finder-methods |
# |
Jun 2nd 2021, 15:09 |
ndm |
@y.teruyacookie That's not how the `find()` method works, it only take two arguments, the first being the finder name, and the second being an array of options. Similarly finder methods also only take two arguments, the first being the query object, the second being the options array. |
# |
Jun 2nd 2021, 14:58 |
slackebot |
->where(function (QueryExpression $exp) use { return $exp->between('Models.created', '2021-04-01 00:00:00', '2021-04-10 00:00:00'); }) ->order([ 'Models.created' => 'ASC' ]) ->find('Contain'); }``` |
# |
Jun 2nd 2021, 14:58 |
slackebot |
index() { // output JSON file return $this->setDatas($begin, $end); } public function setDatas($begin, $end) { $datas = $this->Model->find('Datas'); $spreadSheets = $this->Component->toSpreadSheetDatas($datas); return $this->response->withType('application/json') ->withStringBody(json_encode($spreadSheets)); } src/Model/Table/ModelTable.php public function findDatas(Query $query) { return $query ->find('Fields') |
# |
Jun 2nd 2021, 14:58 |
slackebot |
select the fields (columns) we want from the table with the select method ->where(function (QueryExpression $exp) use ($begin, $end) { return $exp->between('Models.created', $begin, $end); }) ->order([ 'Models.created' => 'ASC' ]) ->find('Contain'); // Use contain method to join other tables as needed }``` `Code that does not cause memory overload` src/Controller/Api/Controller.php ```public function |
# |
Jun 2nd 2021, 14:58 |
slackebot |
$begin, $end); *2 // Format the data for output to a spreadsheet $spreadSheets = $this->Component->toSpreadSheetDatas($datas); // Store the data in the body of the response return $this->response->withType('application/json') ->withStringBody(json_encode($spreadSheets)); } // src/Model/Table/ModelTable.php public function findDatas(Query $query, string $begin, string $end) { *3 return $query ->find('Fields') // |
# |
Jun 2nd 2021, 14:58 |
slackebot |
loaded. If anyone knows, please let me know. Thanks in advance. `Code that goes over memory.` src/Controller/Api/Controller.php ```public function setDatas($begin, $end) { // Store the body data of the received POST request $begin = $this->request->getData('begin'); $end = $this->request->getData('end'); *1 // Get data from Model (same as ↓findDatas($this->Model, $begin, $end)) $datas = $this->Model->find('Datas', |
# |
Jun 2nd 2021, 14:58 |
slackebot |
usage goes up very high as soon as I add the parameter. Also, is there any way to avoid this memory error? (By the way, I tried to increase the memory_limit in php.ini to 1GB, but it still caused a memory error, even if I increased it to the spec value of my PC. In the following code, I tried to debug() at *1, *2, and *3, and I got memory overload errors except for *1, so I think the memory error occurs right after the findDatas is |
# |
Jun 2nd 2021, 14:58 |
slackebot |
... bytes exhausted”. (The error occurs even if I make the difference between $begin and $end in the code below very small. On the other hand, if I set the two arguments $begin and $end of findDatas in the Model to constants, the code will work without memory overload. On the other hand, if I set the two arguments $begin and $end of findDatas in the Model to constants, the code passes without memory overload. It seems that the memory |
# |
Jun 2nd 2021, 14:58 |
y.teruyacookie |
Hi, I need your help. ## Environment Mac OS, Chrome, CakePHP version 3 ## What I’m working on Implementing a function that receives the body of a POST request and returns a resource accordingly. ## What I want to do and what I want to solve I would like to write the following code to implement the function mentioned above, but when I run it, I get a memory overload error saying “Fatal error: Allowed memory size of |
# |
Jun 2nd 2021, 13:27 |
greg138 |
It could just as easily be argued that adding tags to a record *is* an update, and so it's doing exactly the right thing. So, I expect that removing the behavior when you don't want that to happen (whether because of this sort of thing or something else) is the right answer. |
# |
Jun 2nd 2021, 09:42 |
k4t |
thank you |
# |
Jun 2nd 2021, 09:42 |
k4t |
understand |
# |
Jun 2nd 2021, 09:40 |
philo.hamel |
and the theme is part of the view |
# |
Jun 2nd 2021, 09:39 |
philo.hamel |
that's the purpose of the helper: it's view context aware |
# |
Jun 2nd 2021, 09:37 |
k4t |
no... Assets class, with helpr this is ok... |
# |
Jun 2nd 2021, 09:36 |
philo.hamel |
using the helper? |
# |
Jun 2nd 2021, 09:36 |
k4t |
the same problem when it is also used directly in the view |
# |
Jun 2nd 2021, 09:34 |
philo.hamel |
unless there's a good reason to keep the view code in the entity, I'd try to move it into the view |
# |
Jun 2nd 2021, 09:30 |
k4t |
and in the view.php it is called in that way: <?= $article->imageUrlForSharing; ?> |
# |
Jun 2nd 2021, 09:30 |
k4t |
``` protected function _getImageUrl() { return Asset::imageUrl('sharing-fallback.png', ['fullBase' => true, 'plugin' => true]); }``` |
# |
Jun 2nd 2021, 09:29 |
k4t |
to be honest inside of entity |
# |
Jun 2nd 2021, 09:27 |
philo.hamel |
inside a template? https://api.cakephp.org/4.0/class-Cake.View.Helper.UrlHelper.html#image() |
# |
Jun 2nd 2021, 09:23 |
k4t |
I even tried tto add plugin = true to the options but it did not solve the problem |
# |
Jun 2nd 2021, 09:21 |
k4t |
In latest CakePHP I am using: https://api.cakephp.org/4.0/class-Cake.Routing.Asset.html#imageUrl() but it look like that function does not take active theme into account so all urls generated by it does not contain active theme prefix. Is this bug or I missed something? |
# |
Jun 2nd 2021, 07:19 |
kgb.acct.personal |
Good day. Is it possible for the bake migration snapshot command to include the index names? |
# |
Jun 2nd 2021, 06:16 |
thomas465 |
yeah, that’s what i’m thinking too, as a stopgap at least, but i’m just wondering if this is something that should be fixed either in the ORM or in `TimeStampBehavior` ? |