# |
Jul 6th 2021, 14:13 |
charolastra |
also maby you need to enable the module itself |
# |
Jul 6th 2021, 14:01 |
kevin.pfeifer |
google is usually your friend here |
# |
Jul 6th 2021, 14:00 |
kevin.pfeifer |
but as charolastra said you could also use PHP in apache via CGI or FPM |
# |
Jul 6th 2021, 14:00 |
kevin.pfeifer |
if its using the apache built in PHP module then it should suffice to ```LoadModule php7_module modules/libphp7.so <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch>``` |
# |
Jul 6th 2021, 13:56 |
nayakvradhit |
I am using apache webserver |
# |
Jul 6th 2021, 12:34 |
charolastra |
and how it interfaces to PHP. there's CGI, FPM, .. |
# |
Jul 6th 2021, 11:40 |
kevin.pfeifer |
depends on your used webserver |
# |
Jul 6th 2021, 11:33 |
nayakvradhit |
Ok then how can I interpret php |
# |
Jul 6th 2021, 11:17 |
charolastra |
sounds like your webserver doesn't interpret it as PHP at all |
# |
Jul 6th 2021, 10:50 |
nayakvradhit |
Hi can anyone please tell me when I run the file test.php contains phpinfo, Output I am not getting php information instead it outputs the php code? Any idea why |
# |
Jul 6th 2021, 10:05 |
paolo.bragagni |
ok thanks |
# |
Jul 6th 2021, 10:04 |
paolo.bragagni |
$linguaarray = $lingua->toArray(); |
# |
Jul 6th 2021, 10:04 |
info315 |
@paolo.bragagni My controllers are doing it like so: https://github.com/it-novum/openITCOCKPIT/blob/development/src/Controller/CommandsController.php#L112-L147 My App is 100% API driven. Basically it's: receive data from post call patch entity return the entity via CakePHP auto json serialize method: https://book.cakephp.org/4/en/views/json-and-xml-views.html |
# |
Jul 6th 2021, 09:55 |
charolastra |
if Datasource->timezone is UTC but App->defaultTimezone is something different, should the dates be automaticly converted? |
# |
Jul 6th 2021, 09:52 |
paolo.bragagni |
how to send back the data saved (with the primaryKey and the other data? |
# |
Jul 6th 2021, 09:51 |
paolo.bragagni |
when I save in this way $this->Lingue->save($lingua) |
# |
Jul 6th 2021, 09:51 |
paolo.bragagni |
I have to send back via json the data saved |
# |
Jul 6th 2021, 09:37 |
paolo.bragagni |
it works sorry |
# |
Jul 6th 2021, 09:31 |
paolo.bragagni |
(I'm creating a bake template) |
# |
Jul 6th 2021, 09:31 |
dereuromark |
but your approach should still work as well - see live https://sandbox.dereuromark.de/sandbox/ajax-examples/form working example. |
# |
Jul 6th 2021, 09:31 |
paolo.bragagni |
the 'id'=>'addlingue' doesnt works in cake4 |
# |
Jul 6th 2021, 09:30 |
dereuromark |
depends on how many fields maybe for only 1-2 it could also be manual, e.g. var selectedValue = $(this).val(); var targeturl = $(this).attr('rel') + '?id=' + selectedValue; |
# |
Jul 6th 2021, 09:27 |
paolo.bragagni |
data: $("#addlingue" ).serialize() |
# |
Jul 6th 2021, 09:27 |
paolo.bragagni |
and when I clicked to submit I called the controlled via ajax whit |
# |
Jul 6th 2021, 09:24 |
paolo.bragagni |
<?php echo $this->Form->create('Lingua',array('id'=>'addlingue','novalidate' => true,'url' => false, 'method' => false)); ?> |
# |
Jul 6th 2021, 09:24 |
paolo.bragagni |
In my old cake2 project I used to create the form in this way |
# |
Jul 6th 2021, 09:23 |
paolo.bragagni |
how to send form data via ajax to a specific controller? |
# |
Jul 6th 2021, 06:21 |
kevin.pfeifer |
ok, I think my problem was just, that I believed the default was set to false and I had to manually enable e.g. routes (maybe this was how it was handled in the past) |
# |
Jul 6th 2021, 06:18 |
admad |
You can then override it through the option in `addPlugin()`, for e.g. if a plugin has routes enabled but you don't need them you can use `'routes' => false` when adding |
# |
Jul 6th 2021, 06:18 |
lzz |
Ok, the testCsrfAppliedOk() was missing enableSecurityToken(). |
# |
Jul 6th 2021, 06:17 |
kevin.pfeifer |
alright, thx :+1: |
# |
Jul 6th 2021, 06:16 |
admad |
Right |
# |
Jul 6th 2021, 06:14 |
kevin.pfeifer |
sure, but the default for all these variables is set to true https://github.com/cakephp/cakephp/blob/master/src/Core/BasePlugin.php#L37 So all properties, which I don’t need, should be set to false inside my Plugin.php |
# |
Jul 6th 2021, 05:39 |
slackebot2 |
is there. |
# |
Jul 6th 2021, 05:39 |
lzz |
Hello. After enabling Authorization in my cakephp baked code, I have some tests failing in the baked PagesControllerTest.php. testMissingTemplate() returns 500 even though the first line in display() is the skipAuthorization() call. Opening from the webbrowser I correctly get the MissingTemplateException. Also, testCsrfAppliedOk() is returning 400 and logging that _Token was not found in request data. But the enableCsrfToken() line |
# |
Jul 6th 2021, 05:30 |
admad |
@kevin.pfeifer those properties set the default. For e.g. no point having routes hook enabled if your plugin doesn't set any routes. |
# |
Jul 5th 2021, 20:30 |
kevin.pfeifer |
otherwise you could always create a virtual field if you don’t need to query it https://book.cakephp.org/4/en/orm/entities.html#creating-virtual-fields |
# |
Jul 5th 2021, 20:23 |
slackebot2 |
'Roles.name' // or whatever the column field is for the name of the role ] ] ); }``` |
# |
Jul 5th 2021, 20:23 |
kevin.pfeifer |
looking at https://book.cakephp.org/4/en/orm/retrieving-data-and-resultsets.html#eager-loading-associations-via-contain I would guess something like ```public function findForAuthentication(\Cake\ORM\Query $query, array $options): \Cake\ORM\Query { return $query->contain( [ 'Staffs', 'Students', 'StudentParents', 'UserRoles.Roles' => [ |
# |
Jul 5th 2021, 19:59 |
alamnaryab |
How can I get plain array of role-names in above Finder |
# |
Jul 5th 2021, 19:58 |
slackebot2 |
`UserRoles` objects while I want simple array or roles as `['admin','super-admin']` because in my project I have used `in_array('admin',$this->Auth->roles() ){ ... }` and ``array_intersect(['admin','role2'],$this->Auth->roles() ){ ... }` |