# |
Jul 12th 2021, 16:40 |
tyler.adam.lazenby |
how do I force the router to use that scope when I am trying to create links |
# |
Jul 12th 2021, 16:39 |
slackebot2 |
'newUser']); // This one works but isn't automatically used by the link generator $this->Html->link() or by the Router::url() });``` |
# |
Jul 12th 2021, 16:39 |
tyler.adam.lazenby |
Question. I have a scope that I am trying to create. I have two actions so far. The problem is that only one of them gets automatically generated when using a link command. ```$builder->scope('/account', function (RouteBuilder $builder) { $builder->connect('/', ['controller' => 'Accounts', 'action' => 'userIndex']); // this one works $builder->connect('/new-user', ['controller' => 'Accounts', 'action' => |
# |
Jul 12th 2021, 16:15 |
richard |
@ndm thanks will look into it |
# |
Jul 12th 2021, 16:08 |
tyler.adam.lazenby |
Sorry for any confusing changing my display name may cause right now, but I thought that I should just change my display name to match my github account. |
# |
Jul 12th 2021, 16:06 |
ndm |
@richard Depends on your needs and your environment I guess... you may want to give a tool like percona monitoring a try. |
# |
Jul 12th 2021, 16:05 |
tyler.adam.lazenby |
oh sorry I just googled that. That isn't a chat acronym that I have run across. I must be getting old. |
# |
Jul 12th 2021, 16:05 |
tyler.adam.lazenby |
afaik? |
# |
Jul 12th 2021, 16:04 |
dereuromark |
Submit was never intended for HTML afaik |
# |
Jul 12th 2021, 16:04 |
tyler.adam.lazenby |
That is my work around for now |
# |
Jul 12th 2021, 16:04 |
dereuromark |
Use button() instead. |
# |
Jul 12th 2021, 16:00 |
tyler.adam.lazenby |
the escape and escapeTitle options are not working |
# |
Jul 12th 2021, 16:00 |
tyler.adam.lazenby |
I would like to report a bug on the submit element on the Form helper |
# |
Jul 12th 2021, 15:44 |
japerlman |
@ndm Thank you! |
# |
Jul 12th 2021, 15:33 |
richard |
question not necessarily related to cake but will ask here for now in case someone happens to know, I have a sneaking suspicion that a cake app i put together is getting a lot of mysql requests during peak times, causing a lull in the mysql process, what is the best way to record/verify this and what is the best solution for this? |
# |
Jul 12th 2021, 15:33 |
ndm |
@paolo.bragagni Why don't you iterate `associations`, which already has the keys that denote the type of association? |
# |
Jul 12th 2021, 15:32 |
ndm |
@japerlman There's still a component that you can use for retrieving user data: `$this->Authentication->getIdentity()->get('user_id');` This is preferred over accessing the possible storage like the session, as it keeps your code separate from the used authentication method. https://book.cakephp.org/authentication/2/en/authentication-component.html https://book.cakephp.org/authentication/2/en/migration-from-the-authcomponent.html |
# |
Jul 12th 2021, 15:06 |
japerlman |
if I look at just getRequest() it's there, just a matter of reading it properly, awesome, thanks for the help! |
# |
Jul 12th 2021, 15:05 |
japerlman |
odd, it's like I don't have a session? |
# |
Jul 12th 2021, 15:04 |
japerlman |
Call to a member function read() on null |
# |
Jul 12th 2021, 14:40 |
conehead |
@japerlman try if you can get it via $this->getRequest()->getSession->read(); |
# |
Jul 12th 2021, 14:32 |
japerlman |
sorry that phrasing was awful, I just want to know how to read the user_id of the logged in user |
# |
Jul 12th 2021, 14:32 |
japerlman |
Can anyone please tell me what is the new authentication middleware version of the old auth component of, not finding it on google somehow ```$uid = $this->Auth->User('user_id');``` |
# |
Jul 12th 2021, 10:59 |
paolo.bragagni |
in loop I'fd like to check if relation is HM or is BTM |
# |
Jul 12th 2021, 10:59 |
paolo.bragagni |
no |
# |
Jul 12th 2021, 10:55 |
paolo.bragagni |
?? |
# |
Jul 12th 2021, 10:55 |
paolo.bragagni |
{% set myArray =myArray |merge({"HasMany":associations.HasMany}) %} {% set myArray =myArray |merge({"BelongsToMany":associations.BelongsToMany}) %} |
# |
Jul 12th 2021, 10:40 |
paolo.bragagni |
how to insert in relation another field? |
# |
Jul 12th 2021, 10:40 |
paolo.bragagni |
I'd like to discern if the association is HM or BTM in relations |
# |
Jul 12th 2021, 10:38 |
paolo.bragagni |
{% set relations = associations.BelongsToMany|merge(associations.HasMany) %} |
# |
Jul 12th 2021, 10:38 |
paolo.bragagni |
in twig I'd like to rewrite this |
# |
Jul 12th 2021, 09:41 |
conehead |
Was debugging an array (Session), but when trying to access a specific key it said "not found" one line later |
# |
Jul 12th 2021, 09:31 |
kevin.pfeifer |
browser extensions are the devil |
# |
Jul 12th 2021, 09:27 |
conehead |
What the hell...thought I was going crazy.... Any german here using the browser plugin: "binnen i be gone"? Absolutely NOT compatible with coding/debugging smaller things |
# |
Jul 12th 2021, 09:18 |
dereuromark |
Well, one could always look into CRUD plugin :) As that is designed to do those things more dynamically. |
# |
Jul 12th 2021, 09:15 |
conehead |
Let's say, it cannot guess dynamically. Probably it could but that would cause a pain in the ass everytime you want to change tiny things. It is something completely different to generate fields that are declared in a table/model than to load data from the database in the background. Additionally that would totally not fit into MVC pattern |
# |
Jul 12th 2021, 08:42 |
dereuromark |
If u bake your Code yes, it will add the needed calls to Controller. It does not work magically :) |
# |
Jul 12th 2021, 07:04 |
mehov |
Also, Cake does have `allControls()`, which is the same "guess" concept |
# |
Jul 12th 2021, 07:02 |
mehov |
let me try your advice though. thank you! |
# |
Jul 12th 2021, 07:02 |
mehov |
yep, manually is how I've been doing this all this time :D |
# |
Jul 12th 2021, 07:02 |
mehov |
Since Cake is *convention over configuration*, I actually thought it will "guess", because I did my job following the conventions and declaring the association, so it kind of makes sense for Cake to understand that I want a select box full of Authors and therefore populate them |