# |
Apr 30th 2021, 15:56 |
martin |
Can I access the authorization inside a entity? I need to have in api response if user can edit a entity. |
# |
Apr 30th 2021, 13:42 |
louis |
Does it indent well your template file ? Php is well formatted but the HTML is not |
# |
Apr 30th 2021, 13:23 |
louis |
Thanks @admad ! |
# |
Apr 30th 2021, 13:12 |
admad |
install https://github.com/cakephp/cakephp-codesniffer/ so can use can use the coding standard "CakePHP" for phpcs |
# |
Apr 30th 2021, 13:11 |
admad |
@louis don't use intelephense's code formatter. Install this plugin for phpcs https://github.com/wongjn/vscode-php-sniffer and use that for formatting. |
# |
Apr 30th 2021, 12:49 |
sebastiansperandio093 |
I just use it when vscode "make yours" |
# |
Apr 30th 2021, 12:49 |
sebastiansperandio093 |
but I dont use too |
# |
Apr 30th 2021, 12:48 |
sebastiansperandio093 |
mmm I have a plugin called beautify |
# |
Apr 30th 2021, 12:33 |
louis |
Hello there, First time i’m working on a CakePHP 4 app, layout extension is now .php. I struggle with indent, VScode with intelephense broke all indent :,( |
# |
Apr 30th 2021, 11:13 |
joacir.santos |
@revillosakristianpaol I think you should use Expression like this: ```$expression = new QueryExpression('quantity = quantity + 10'); $updated = $this->updateAll([$expression], ['id' => 4]);``` |
# |
Apr 30th 2021, 08:10 |
kevin.pfeifer |
even though it should in my opinion |
# |
Apr 30th 2021, 08:10 |
kevin.pfeifer |
i am trying that right now too but somehow this doesn’t work ```$this->Projects->updateAll(['Projects.netto' => 'Projects.netto + 1'], ['Projects.id' => 3]);``` |
# |
Apr 30th 2021, 07:50 |
revillosakristianpaol |
im using updateAll |
# |
Apr 30th 2021, 07:47 |
kevin.pfeifer |
are you using the patchEntity method or the updateAll method? |
# |
Apr 30th 2021, 07:28 |
revillosakristianpaol |
I have another question, how do i update record with records from previous data in sql it look like this "update table set quantity = quantity+10 where Id = 4; |
# |
Apr 30th 2021, 07:27 |
revillosakristianpaol |
Thanks for the update |
# |
Apr 30th 2021, 07:21 |
slackebot |
$entity = $this->MyTable->get($data['id']); $entity = $this->MyTable->patchEntity( $entity, $data ); if( $this->MyTable->save( $entity ) ) { $outcome['success'][] = $data['id'] . ' (' . $data['name'] . ')'; } else { $outcome['error'][] = $data['id'] . ' (' . $entity->getErrors() . ')'; } }``` |
# |
Apr 30th 2021, 07:21 |
kevin.pfeifer |
`updateAll()` basically executes the update command directly and returns the number of rows affected But as far as I know there is no validation process being done here so your custom validator rules don’t apply if you update your entries like that. If you want to know per entry/entity what validation errors you get you should do something like this: ``` $outcome = []; foreach($new_data_array, $data) { |
# |
Apr 30th 2021, 06:58 |
revillosakristianpaol |
how to know if $table->updateAll executed successfully |
# |
Apr 30th 2021, 06:58 |
revillosakristianpaol |
hi |
# |
Apr 30th 2021, 06:46 |
admad |
`--skel` is replaced by `--theme` in Cake 4, you'll have to replicae the `project` command yourself. |
# |
Apr 30th 2021, 06:04 |
paolo.bragagni |
(I'd like to replicate for new projects, then I'll think to porting..) |
# |
Apr 30th 2021, 06:04 |
paolo.bragagni |
In your opinion which is the best way? |
# |
Apr 30th 2021, 06:03 |
paolo.bragagni |
I have more that 100 projects built in that way (in few linux servers) and I'd like to 'replicate' it in cakephp 4 |
# |
Apr 30th 2021, 06:02 |
paolo.bragagni |
was 'son' of /var/www/html/cake2.10.16/ |
# |
Apr 30th 2021, 06:01 |
paolo.bragagni |
so al my project built with ./cake bake project --skel Templates/myskel |
# |
Apr 30th 2021, 06:01 |
paolo.bragagni |
my skel pointed to /var/www/html/cake2.10.16/ for 'core' |
# |
Apr 30th 2021, 06:00 |
paolo.bragagni |
and I had built a skel whit all my changing, plugins, ecc.. |
# |
Apr 30th 2021, 05:59 |
paolo.bragagni |
In my 'old' cakephp 2 linux server I had a 'core' in (example) /var/www/html/cake2.10.16/ |
# |
Apr 30th 2021, 05:58 |
paolo.bragagni |
trying to find a way to replicate 'cake bake project' .. :S |
# |
Apr 29th 2021, 22:05 |
greg138 |
My memory is not what it used to be. Also, my memory is not what it used to be. |
# |
Apr 29th 2021, 22:04 |
greg138 |
That is indeed what I meant. |
# |
Apr 29th 2021, 21:56 |
kevin.pfeifer |
i guess you mean 81 ;) |
# |
Apr 29th 2021, 21:49 |
greg138 |
What does line 181 of `C:\xampp\htdocs\ezBusinessManager\src\Controller\AccountsController.php` look like? |
# |
Apr 29th 2021, 21:48 |
kevin.pfeifer |
or check if your UploadedFile object ib your test is actually what you expect it to be |
# |
Apr 29th 2021, 21:46 |
kevin.pfeifer |
seems like something goes wrong in your controller function where you pass the submitted data aka file to your AWS Component if you got xdebug running you can try to set a breakpoint in your controller function and see what your state is in there when you execute the test |
# |
Apr 29th 2021, 17:33 |
tyler.adam.lazenby |
well that didn't make a difference but at least I caught that |
# |
Apr 29th 2021, 17:33 |
tyler.adam.lazenby |
ooof its a png |
# |
Apr 29th 2021, 17:32 |
tyler.adam.lazenby |
```$this->enableCsrfToken(); $this->post('/accounts/add', $data); $this->assertResponseOk();``` |
# |
Apr 29th 2021, 17:32 |
tyler.adam.lazenby |
and finally the test |
# |
Apr 29th 2021, 17:32 |
tyler.adam.lazenby |
```$data = [ 'user' => $user, 'name' => $name, 'phone_number' => $phone_number, 'Addresses' => $Addresses, 'is_billing_same_as_mailing' => "1", 'logo' => $this->testFile, ];``` |