# |
Jun 28th 2021, 14:50 |
admad |
@ankitgsolanki err... needs to be `false` not `null` |
# |
Jun 28th 2021, 14:49 |
ankitgsolanki |
@admad No. Let me try with add this config |
# |
Jun 28th 2021, 14:48 |
admad |
@ankitgsolanki Have you set `'scopes' => null` for the redis config? |
# |
Jun 28th 2021, 14:44 |
info315 |
Me too. Check the Redis Metrics and your Code - something is firing hundreds of requests or stores large files to redis i guess |
# |
Jun 28th 2021, 14:40 |
admad |
If it's not the default cache and it's not used for the current request then Cake wouldn't even connect to it, so don't see how it could cause any slowdown. |
# |
Jun 28th 2021, 14:38 |
ankitgsolanki |
I have defined new cache for redis server in app.php and default cache is file cache |
# |
Jun 28th 2021, 14:36 |
info315 |
Have you set your default cache to redis? Or did you defined a new cache in app.php just for the particular data that has to be stored to redis? |
# |
Jun 28th 2021, 14:32 |
ankitgsolanki |
@info315 At this post request I am not sending any request to Redis server. |
# |
Jun 28th 2021, 14:31 |
info315 |
@ankitgsolanki How many requests do you send to the redis server per POST request? |
# |
Jun 28th 2021, 14:30 |
tomrwaller |
Thanks again @ndm - your tip pointed me in the right direction and I ended up looking at the BootstrapUI plugin by FriendsOfCake which has shown me how to avoid using dumb templates! |
# |
Jun 28th 2021, 14:27 |
ankitgsolanki |
Also try with another redis remote server from https://app.redislabs.com/ but same issue facing this remote server as well |
# |
Jun 28th 2021, 14:26 |
ankitgsolanki |
In a local redis server it takes 10 seconds |
# |
Jun 28th 2021, 14:24 |
info315 |
try with an local redis server running on 127.0.0.1 to test if it's an Redis or an AWS issue |
# |
Jun 28th 2021, 14:23 |
info315 |
Than you are facing most likely a network latency issue |
# |
Jun 28th 2021, 14:22 |
ankitgsolanki |
@info315 Yes. It is in AWS Elastic Cache |
# |
Jun 28th 2021, 14:21 |
info315 |
@ankitgsolanki Is your Redis server running on a remote host? |
# |
Jun 28th 2021, 13:08 |
info315 |
@ndm Ahh perfect thanks. |
# |
Jun 28th 2021, 13:05 |
ndm |
@info315 That's just incorrect error output for missing elements https://github.com/cakephp/cakephp/issues/15619 |
# |
Jun 28th 2021, 12:58 |
info315 |
Hi, i have a question about View Elements. I'm trying to load an element from an Plugin like so: ```echo $this->element('HyperscaleModule.warning');``` My issue is, that CakePHP 4 adds the name of the Plugin to the element file name and complains that it can not find the element: ```- /opt/openitc/frontend-modules/HyperscaleModule/templates/element/HyperscaleModule.warning.php``` |
# |
Jun 28th 2021, 12:20 |
ankitgsolanki |
Hello All, Cake Application works very slow when I have implemented the Radis cache. If I Remove Redis Cache configuration then it's works very fast. *Example:* Without Redis cache one post request take 2 seconds to complete the request. With Redis cache same post request take 20 seconds to complete the request. Can anyone have any idea that why cake application works very slow when I use redis cache? |
# |
Jun 28th 2021, 12:17 |
ndm |
@tomrwaller Templates are stupid, they cannot apply logic. If you don't want to manually pass options when creating controls, then you'll most likely either need a custom widget, or a custom form helper. |
# |
Jun 28th 2021, 10:38 |
slackebot |
to be a valid template option - I end up with the input style applied - input should be 'form-control' class while a range should be 'form-range' style. `'rangeContainer' => '<div class="form-group mb-11">{{content}}</div>',` Anyone know if there is a corresponding 'range' variable I can use? |
# |
Jun 28th 2021, 10:38 |
tomrwaller |
Hey all - I'm trying to style my range input for Bootstrap and need to provide a different input class to normal text input. I'm using a form helper template to acheive this and mostly getting there, but I'm stuck trying to differentiate between input and range in the template. For example, 'input' and 'inputContainer' work, and I can even use 'rangeContainer' to provide the correct container style - but 'range' doesn't seem |
# |
Jun 28th 2021, 09:43 |
conehead |
Then you got a completely different problem and that is probably not a cake problem. Using a view should not make a noticable difference |
# |
Jun 28th 2021, 09:34 |
dantedantas |
Performance. It was too slow. |
# |
Jun 28th 2021, 08:10 |
conehead |
First of all...you said it works within a view. So why don't you use that view? |
# |
Jun 28th 2021, 07:54 |
dantedantas |
@conehead, thank you for your tipps. How could I load the Helper? Something like: `use Cake\ORM\Helper;` ? |
# |
Jun 28th 2021, 07:50 |
slackebot |
learn and understand :( ) |
# |
Jun 28th 2021, 07:50 |
dantedantas |
I know that I need to do the tutorial ones again and learn a lot more things in order to understand better the CakePHP environment, but the issue here is time. What I think to do is to solve by sending HTML via Ajax, and then, learn as it really should be, test and implement a new version. Or... if I find a tutorial that shows me how it should work, then I will test to see if it will not require a lot of time from my side (to |
# |
Jun 28th 2021, 07:45 |
dantedantas |
Probably it isn't the best solution. But I have not a lot of time to look for a different solution. The issue here is that I am new with CakePHP and I am also not a PHP specialist. @admad, @conehead and @kevin.pfeifer, maybe one of you could know a website or youtube tutorial that shows how I could build a solution with Ajax to load info from the DB with CakePHP? |
# |
Jun 28th 2021, 07:36 |
dantedantas |
Thank you for the help. Yes, I to return a HTML code via an Ajax Call. |
# |
Jun 28th 2021, 07:10 |
kevin.pfeifer |
as ADmad already said you really really really shouldn't just copy/move code from the view into the controller (basically break the whole MVC concept) `$this` in a controller is not the same as `$this` inside a view/template So I guess you want to return HTML via your AJAX call? |
# |
Jun 28th 2021, 07:02 |
conehead |
@dantedantas In other words: that code should still be in a view and never in the controller. Check if the request is an ajax call and render a different template if necessary. Btw: The code says that "$this->Form" is null. Cake loads the Form helper before rendering the view, which you are missing. So just in theory you would have to initiate that helper class before |
# |
Jun 28th 2021, 05:29 |
admad |
> If I copy and paste the code into a Controller Action and call it by an Ajax function in the VIEW, then it returns the error. Doh, no wonder. |
# |
Jun 28th 2021, 05:28 |
admad |
What monstrosity is this, why is there html/view code in your controller class? |
# |
Jun 28th 2021, 01:40 |
dantedantas |
Sorry, maybe I am not clear... the same code works in the VIEW. If I copy and paste the code into a Controller Action and call it by an Ajax function in the VIEW, then it returns the error. |
# |
Jun 28th 2021, 01:36 |
dantedantas |
Sorry, I pressed the "Enter button" by mistake. :( So... could someone help me to identify why I am getting this error? |
# |
Jun 28th 2021, 01:33 |
dantedantas |
Error: Call to a member function create() on null Hello Team, I am calling a Controller Action from a View (Ajax) that returns a string. The error is in this line below: `$tosal = $this->Form->create(null, ['url' => ['controller' => 'torgsal','action' => 'add']]);` My code is running in the view. I did a copy from the code at the View and inserted in the Controller the code that I copied and it works fine. |
# |
Jun 27th 2021, 18:40 |
cnizzardini |
ServerRequest accepts an array argument in the constructor |
# |
Jun 27th 2021, 18:40 |
cnizzardini |
This might be why: Unfortunately, this method of resolution has a few small limitations but is great for smaller apps. First of all, you are limited to constructor injection and secondly, all injections must be objects. |
# |
Jun 27th 2021, 18:38 |
cnizzardini |
removing `->defaultToShared()` causes the timeout elsewhere |