Log message #4266662

# At Username Text
# 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
# Jun 27th 2021, 18:36 cnizzardini Yeah I was engaging Mark over twitter and he pointed me in this direction
# Jun 27th 2021, 18:35 kevin.pfeifer well you can definitely create an issue where you explain what you would like to be implemented. Since this feature is not directly supported by cakephp (but the library cakephp uses for DI) I guess there needs to be more done for this to work. as well as the fact that the DI container is marked as experimental ;)
# Jun 27th 2021, 18:33 cnizzardini Hmm... I wonder if I should report a bug eh?
# Jun 27th 2021, 18:31 kevin.pfeifer seems like it is stuck trying to resolve the ServerRequest class because these values never change
# Jun 27th 2021, 18:30 kevin.pfeifer well i can definitely confirm your error, ( i get a *`Maximum function nesting level of '256' reached`)*
# Jun 27th 2021, 18:22 cnizzardini https://container.thephpleague.com/3.x/auto-wiring/
# Jun 27th 2021, 18:22 cnizzardini I'm trying to avoid needing to define the arguments using auto-wiring
# Jun 27th 2021, 18:21 cnizzardini I am doing this in Plugin.php, but I don't think that should matter
# Jun 27th 2021, 18:21 kevin.pfeifer well the way how I use the DI container with arguments is like that: ``` $container->add( CategoryHelper::class ); $container->add( AlfredFTP::class ) ->addArgument(CategoryHelper::class);```
# Jun 27th 2021, 18:21 cnizzardini ```<b>Fatal error</b>: Maximum execution time of 30 seconds exceeded in <b>/srv/app/vendor/league/container/src/Argument/ArgumentResolverTrait.php</b> on line <b>20</b>```
# Jun 27th 2021, 18:21 cnizzardini Resulting in
# Jun 27th 2021, 18:20 cnizzardini ```$container ->add(GetActorService::class); $container ->defaultToShared() ->delegate((new ReflectionContainer()));```
# Jun 27th 2021, 18:20 cnizzardini So i tried something like this:
# Jun 27th 2021, 18:19 cnizzardini But I'd like to not need to define the arguments
# Jun 27th 2021, 18:19 cnizzardini ```/** @var Container $container */ $container ->add(GetActorService::class) ->addArgument(new ActorsTable());```