Logs for #cakephp

Page 20 of 36,922, showing 100 records out of 3,692,143 total, starting on record 1,901, ending on 2,000

# At Username Text
# 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 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, 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, 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 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:50 slackebot learn and understand :( )
# 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());```
# Jun 27th 2021, 18:19 cnizzardini So this works fine:
# Jun 27th 2021, 18:18 cnizzardini I'm probably doing stuff wrong
# Jun 27th 2021, 18:17 kevin.pfeifer I heavily use the new DI container, and got no problems. Can you explain your problem in more detail?
# Jun 27th 2021, 18:16 cnizzardini Has anyone gotten auto wiring working with the new DI stuff? I am getting timeouts.
# Jun 27th 2021, 15:33 kevin.pfeifer well thats something I totally overlooked when i read through the documentation :see_no_evil: ,:)
# Jun 27th 2021, 15:20 ndm @alamnaryab Configure a custom finder for the related identifier's ORM Resolver, you can then contain your associations in that finder. https://stackoverflow.com/questions/63057543/cakephp-4-1-user-entity-as-authorization-identity-associated-fields/63061706#63061706
# Jun 27th 2021, 10:55 alamnaryab I think it is like below but I could not found any documentation or example ``` $result = $this->Authentication->setIdentity($userWithContainedModels); $result = $result->getResult();```
# Jun 27th 2021, 10:41 kevin.pfeifer ``` $result = $this->Authentication->getResult(); if($result){ $user = $result->getData(); }``` the $user is an entity which has its own fields but does not contain any fields from other (containing) models (like roles) How to tell the authentication service that the resulting user entity should contain other models I can’t tell you right now but I am curious too :thinking_face:
# Jun 26th 2021, 23:02 alamnaryab `$result = $this->Authentication->getResult();` `$result` has a protected property `_data` which has logged in user record. I am not able to find documentation how to append its protect property `_data`
# Jun 26th 2021, 22:59 alamnaryab Good Morning I am using cakephp 4 Authentication plugin https://book.cakephp.org/4/en/tutorials-and-examples/cms/authentication.html on successful login I also want to get roles from database for that user. how can I do?
# Jun 26th 2021, 18:52 cnizzardini nevermind, it comes from the league/container, but is not present in the cakephp container interface so phpstorm doesn't know
# Jun 26th 2021, 18:49 cnizzardini Documentation indicates there is a `$container->share` method, but I don't see one https://book.cakephp.org/4/en/development/dependency-injection.html#adding-shared-services
# Jun 26th 2021, 15:51 mokiwaa Thk you
# Jun 26th 2021, 15:50 mokiwaa I will check again the logs file and debugkit sql generated ...
# Jun 26th 2021, 15:44 kevin.pfeifer well a hasMany and hasOne aren't that different from a database structure point of view. I haven't used the proffer plugin till now but I guess this shouldn't be the problem. Either way do you have something in your logs directory that could lead to you to some problem? Or maybe check the DebugKit generated sql when showing the file(s) if everything looks like you expect it
# Jun 26th 2021, 15:38 mokiwaa but no luck
# Jun 26th 2021, 15:38 mokiwaa and echo $this->Form->control('brand_logo', ['label'=>'Logo', 'type'=>'file']);
# Jun 26th 2021, 15:38 mokiwaa I have tried to use echo $this->Form->control('brand_logos', ['label'=>'Logo', 'type'=>'file']);
# Jun 26th 2021, 15:38 mokiwaa in the form
# Jun 26th 2021, 15:37 mokiwaa the image get upload
# Jun 26th 2021, 15:37 mokiwaa but if I use hasMany
# Jun 26th 2021, 15:37 mokiwaa I cant make it work
# Jun 26th 2021, 15:37 mokiwaa with hasOne association
# Jun 26th 2021, 15:37 mokiwaa I have a problem with the proffer plugin
# Jun 26th 2021, 15:36 kevin.pfeifer just ask :)
# Jun 26th 2021, 15:35 mokiwaa :)
# Jun 26th 2021, 15:35 mokiwaa still
# Jun 26th 2021, 15:35 mokiwaa stile there?
# Jun 26th 2021, 15:16 kevin.pfeifer yes
# Jun 26th 2021, 15:10 mokiwaa someone online?
# Jun 26th 2021, 15:09 mokiwaa Hi
# Jun 26th 2021, 14:33 kevin.pfeifer from a quick read through I would also say that this data should be present in the junction table between the 2 main tables. And only the junction table has the foreign keys for the 2 main tables - therefore as Zuluru already said a `belongsToMany`
# Jun 26th 2021, 14:19 greg138 It sounds like this should be a `belongsToMany` association for both models, meaning that Answers is the join table. Am I missing something?
# Jun 26th 2021, 13:48 tomrwaller Hey everyone, just wanted to ask for some advice about how I'm currently doing my associations and whether anyone thinks there is a better way. I currently have Assessments and Recommendations. An Assessment has many Recommendations and a Recommendation can belong to many Assessments. I want to store answers to Recommendations for each Assessment. Just a couple of fields maybe up to 10. At the moment I have a Answers model
# Jun 26th 2021, 13:48 slackebot which has foreign keys for Assessment and Recommendation plus the extra data. When I create an Assessment record I use beforeMarshal to create an Answer for each Recommendation that was selected for the Assessment. While this works, it seems a little 'hacky'. Can anyone see a better way to achieve this outcome? I had originally tried with addition join table data but I couldn't figure out a way to join both the Assessment and
# Jun 26th 2021, 13:48 slackebot Recommendation to the Answer and landed on this current solution. What do you guys and gals think?
# Jun 25th 2021, 17:03 ricmelero Thank @admad and @kevin.pfeifer!
# Jun 25th 2021, 17:01 ricmelero never mind, I got it working now, later this year I expect to have fewer work and I may take a look into routing, I have noticed a few cases that are weird or may be improved (like redirecting to array styles named routes) and I'll loved to help...
# Jun 25th 2021, 16:56 steinkel we usually rely on any of the https://github.com/CakeDC/cakephp-api/tree/master/src/Service/Auth/Authenticate for API based applications
# Jun 25th 2021, 16:56 nick.vanderwoude @steinkel I did see that. Is it working?
# Jun 25th 2021, 16:55 steinkel @nick.vanderwoude we did some work time ago to provide a specific endpoint for ajax login here https://github.com/CakeDC/users/pull/789
# Jun 25th 2021, 16:55 ricmelero although placeholder length is arbitrary... mm
# Jun 25th 2021, 16:54 ricmelero and there is no attemp to trying to check longer first.. even that I understand that it may have placeholders or dinamyc parts
# Jun 25th 2021, 16:53 ricmelero yep, I see that krsort, is present in a few places.. and yes @admad, I get that, and that's why I was thinking about it, inside each path, you may have many routes
# Jun 25th 2021, 16:52 admad But you lose that optimization for lang routes since they start with a placeholder
# Jun 25th 2021, 16:51 kevin.pfeifer i guess you mean that krsort https://github.com/cakephp/cakephp/blob/master/src/Routing/RouteCollection.php#L130
# Jun 25th 2021, 16:51 admad It does sort them by *static* longer parts first.
# Jun 25th 2021, 16:50 ricmelero but besides that case, I was thinking that routes is trying to check longer paths first, ordering that way, but inside each path, this behavior does not apply... wouldn't be that a desired behavior? I mean, inside each path, sort routes with longer names or templates first.. I may work in a PR if that's the case
# Jun 25th 2021, 16:47 ricmelero this way is cleaner
# Jun 25th 2021, 16:47 ricmelero I had moved all inside Plugin::routes() method to my routes.php, also worked, but it wasn't feel rigth
# Jun 25th 2021, 16:45 ricmelero yeah, that did the trick,
# Jun 25th 2021, 16:44 admad you can use `$routes->loadPlugin('Foo')` at the top of your `routes.php` to load the plugin's route first.
# Jun 25th 2021, 16:43 ricmelero I can get it working, but it feel like a hack
# Jun 25th 2021, 16:43 ricmelero so, they are loaded after app routes