# |
May 28th 2021, 16:38 |
steinkel |
or send a PR to the file with an example of your issue and how you fixed it, it'll help others in the same situation, thanks! |
# |
May 28th 2021, 16:37 |
steinkel |
we can add that to the documentation for sure! |
# |
May 28th 2021, 16:36 |
st.steinkuehler |
@steinkel OK, I get it, but isn't it documented? Thanks for the hint to override - that's exactly what I wanted and that's why I tried to understand the config loading of the CakeDC plugin better. |
# |
May 28th 2021, 16:33 |
tyler.adam.lazenby |
sugggestion request: How would you go about creating a form to with migration from a old data structure to a new one. I had been using users as the "account" but now I need to make it so that accounts are collections of users. Additionally I need to add addresses. Luckily there aren't a lot of users yet, otherwise that will make it harder. We also don't have any users that we currently need to group together. I am |
# |
May 28th 2021, 16:33 |
slackebot |
more asking on how to group the data together using the Form helper |
# |
May 28th 2021, 16:29 |
steinkel |
if you need to override these settings after plugin load, you can use the `Application::pluginBootstrap` method |
# |
May 28th 2021, 16:29 |
steinkel |
that's a way to name an array of files and get them loaded, and merged into the configuration |
# |
May 28th 2021, 16:27 |
st.steinkuehler |
Hello, in the CakeDC User documentation the file "config/users.php" is loaded with this code `Configure::write('Users.config', ['users']);` into the configuration - but I can find anything in the API-Doc or Book about this file loading behavior of `Configure::write`. Can someone explain? Thanks. |
# |
May 28th 2021, 15:18 |
shahways |
Thanks @admad, will do so. Have a nice weekend! |
# |
May 28th 2021, 14:56 |
admad |
Please open an issue on github. |
# |
May 28th 2021, 14:55 |
admad |
@shahways That's a bug with bake. The unique check should be in build rules only not validation. |
# |
May 28th 2021, 14:49 |
st.steinkuehler |
Thanks |
# |
May 28th 2021, 14:48 |
ndm |
Very likely. |
# |
May 28th 2021, 14:40 |
st.steinkuehler |
Hello, I want to add a parameter into a post request comming from the browser before it reaches the plugin controller code. Is a middleware the right place to do this? |
# |
May 28th 2021, 13:55 |
ndm |
`assertEventFiredWith()`? |
# |
May 28th 2021, 13:37 |
chris301 |
hi guys, i’m currently working on something where i have dispatched a custom Event, and would like to assert that the specific event dispatched has the content i expect it to, but am struggling to find a way of searching for the event in the EventList other than using getOffset(). is there a method i haven’t found yet that would allow me to search for a particular event in the event list in tests? |
# |
May 28th 2021, 13:18 |
neon1024 |
there it is |
# |
May 28th 2021, 13:18 |
neon1024 |
https://github.com/cakephp/cakephp/blob/2.10.24/lib/Cake/Routing/Router.php#L65-L71 |
# |
May 28th 2021, 13:17 |
neon1024 |
You could check the Routing class in your project to see if it supports prefixes |
# |
May 28th 2021, 13:17 |
neon1024 |
@rightscoreanalysis It’s been a long time since I used Cake 2, but I think prefixes still existed back then |
# |
May 28th 2021, 12:04 |
etibor |
i thought you were asking the prefixes |
# |
May 28th 2021, 11:27 |
rightscoreanalysis |
damn it - I thought as much. Cake came a long way since then :) |
# |
May 28th 2021, 11:22 |
khalil |
Your best bet would be to create separate "app" folders for each, and make them all use the same cake lib and webroot |
# |
May 28th 2021, 11:21 |
khalil |
@rightscoreanalysis You need namespaces for the structure you're trying to accomplish, so no it's not possible in Cake 2 |
# |
May 28th 2021, 11:08 |
rightscoreanalysis |
I know I am asking a lot here, but anyone know if controllers in sub-folders is possible in Cake2? |
# |
May 28th 2021, 10:33 |
etibor |
i found getExtension function, but dont know how can i use this for getting if page has different extension than php |
# |
May 28th 2021, 10:32 |
etibor |
in cake3 how can i get the current page extension? |
# |
May 28th 2021, 09:41 |
khalil |
I'm not sure about what bake generates, I haven't used it since bake 1.3 so I don't really have any info |
# |
May 28th 2021, 09:38 |
shahways |
Thanks for your reply @khalil! Your feedback is not confusing, but the documentation in combination with the baked code is somewhat ambiguous. Checking if the email address is valid, is the responsibility of the basic validation (does it have an @ character, does it have a domain name, ... etc.). But based on the docs, ensuring that we have no user registered yet with that same email address, is the job of the application |
# |
May 28th 2021, 09:38 |
slackebot |
rules. This is what we understood based on the documentation. And makes perfect sense. However, the code produced by Bake, repeats the rule in both validation layers, which nullifies the logic described in the docs. So if I interpret the reasoning correctly, we should repeat all application rules in the basic validation as well? Since the application data might change between validation and saving? So any DB query which will be used |
# |
May 28th 2021, 09:38 |
slackebot |
to validate application rules , will run twice. Is this correct? |
# |
May 28th 2021, 09:20 |
khalil |
@shahways to my knowledge, in the case of uniqueness, it is recommended to set the validation on both. Validation methods are meant to give back validation errors before the save process happens, it does that by checking the errors() method, however, Validation doesn't happen inside a database transaction, so you can't really guarantee if the email is still unique between validating and saving. To sum it up, validation work in |
# |
May 28th 2021, 09:20 |
slackebot |
stateless way, application rules work in stateful way, so in case of checking email uniqueness, the validation would handle checking if the email is actually valid, and the application rule checks if the email is unique. I hope I didn't confuse you more :) |
# |
May 28th 2021, 09:19 |
narendravaghela |
It seems working |
# |
May 28th 2021, 09:09 |
narendravaghela |
It doesn't find that `disconnect()` method |
# |
May 28th 2021, 09:02 |
admad |
Did you try using the same? |
# |
May 28th 2021, 08:38 |
narendravaghela |
CakePHP 4: What is the correct way to disconnect from datasource? Earlier in 3.x version, I was used to use following to disconnect ```ConnectionManager::get('default')->disconnect();``` |
# |
May 28th 2021, 08:24 |
khalil |
Your best bet would be to create two separate "app" folders I guess, but it's hell to maintain and setup |
# |
May 28th 2021, 08:21 |
khalil |
You need namespaces for such structure |
# |
May 28th 2021, 08:20 |
khalil |
As far as I remember that's not possible with Cake 2 |
# |
May 28th 2021, 08:14 |
khalil |
@rightscoreanalysis yes it doesn't work with base64 images |
# |
May 28th 2021, 08:14 |
shahways |
So we are now wondering if we misunderstood the 2 validation layers and their purpose? |
# |
May 28th 2021, 08:13 |
shahways |
Hi all, quick check. We would like to add a uniqueness validation on our email field for Users. We noticed that when baking the model for our Users in 4.x, we ended up with two rules to ensure this validation. Once in the basic validation layer, as well as once in the application validation layer. We assumed that it would only be added as an application validation rule, based on the documentation. |
# |
May 28th 2021, 07:47 |
rightscoreanalysis |
Anyone able to help with this relatively simple routing question? https://stackoverflow.com/questions/67730899/cakephp-admin-prefixed-routing |
# |
May 28th 2021, 07:46 |
rightscoreanalysis |
Did you try Neon's Proffer plugin? |
# |
May 28th 2021, 01:45 |
khalil |
Hey guys! Is there an image upload plugin that supports ajax? like base64 images for example? |
# |
May 27th 2021, 22:30 |
rightscoreanalysis |
I actually do not thin what I am trying to do is possible looking at the cake2 source |
# |
May 27th 2021, 22:24 |
kevin.pfeifer |
well i started with cake 3, sooooo ^^ |
# |
May 27th 2021, 22:23 |
rightscoreanalysis |
be glad you no longer have to work with cake 2 :) |
# |
May 27th 2021, 22:23 |
rightscoreanalysis |
seems cake2 prefix routing meant your actons were admin_index etc in the main controller |
# |
May 27th 2021, 22:22 |
kevin.pfeifer |
then I unfortunately can't help you ,:) |
# |
May 27th 2021, 22:22 |
rightscoreanalysis |
I have this working on my cake 3 and 4 projects already |
# |
May 27th 2021, 22:22 |
kevin.pfeifer |
oh, ok ^^ |
# |
May 27th 2021, 22:22 |
rightscoreanalysis |
I am working on a legacy cake2 project |
# |
May 27th 2021, 22:22 |
rightscoreanalysis |
@kevin.pfeifer |
# |
May 27th 2021, 22:19 |
kevin.pfeifer |
see https://book.cakephp.org/4/en/development/routing.html#prefix-routing |
# |
May 27th 2021, 22:18 |
kevin.pfeifer |
@rightscoreanalysis then you need something like that in your plugin ``` $routes->plugin( 'Integrations', [ 'path' => '/integrations' ], function( RouteBuilder $builder ) { // Add custom routes here $routes->prefix('Foobar', function (RouteBuilder $routes) { // All routes here will be prefixed with `/foobar`, and // have the `'prefix' => 'Foobar'` route element added that // |
# |
May 27th 2021, 22:18 |
slackebot |
will be required when generating URLs for these routes $routes->fallbacks(DashedRoute::class); }); $builder->fallbacks(); } );``` |
# |
May 27th 2021, 22:15 |
rightscoreanalysis |
where integratinos is a plugin and foobar is a subdirectory of controllers |
# |
May 27th 2021, 22:14 |
rightscoreanalysis |
I just want to make a simple sub-directory for a group of controllers: Router::connect( '/integrations/foobar/*', ); |
# |
May 27th 2021, 21:12 |
CakeIsGreat |
$this->Events instead of $post->Events but doesn't fix anything |
# |
May 27th 2021, 21:12 |
CakeIsGreat |
Did just catch an error regarding setting $this-> |
# |
May 27th 2021, 21:08 |
CakeIsGreat |
https://pastebin.com/fB9ECn9X |
# |
May 27th 2021, 21:08 |
CakeIsGreat |
Cake isn't saving any associations. Anyone mind taking a look the controller? Can't figure this out. |
# |
May 27th 2021, 20:55 |
rightscoreanalysis |
ok looks like I can do what i need to do in the bootstrap |
# |
May 27th 2021, 20:54 |
greg138 |
`core.php` in your plugin? I didn't think that was even a thing. Isn't `core` for, well, Cake's core? |
# |
May 27th 2021, 20:50 |
rightscoreanalysis |
although now core.php is not being read :face_palm: |
# |
May 27th 2021, 20:47 |
rightscoreanalysis |
ah fixed it :) |
# |
May 27th 2021, 20:45 |
rightscoreanalysis |
I also added 'routes' => true |
# |
May 27th 2021, 20:44 |
rightscoreanalysis |
adding bootstrap true requires that i have a bootstrap.php in my plugin/Config dir, but the routes.php is still not being read |
# |
May 27th 2021, 20:29 |
kevin.pfeifer |
:+1: |
# |
May 27th 2021, 20:29 |
rightscoreanalysis |
that was it thanks @kevin.pfeifer |
# |
May 27th 2021, 20:25 |
rightscoreanalysis |
hmm good spot |
# |
May 27th 2021, 20:25 |
kevin.pfeifer |
when loading the plugin did you add ```'routes' => true``` |
# |
May 27th 2021, 20:24 |
rightscoreanalysis |
"A plugin can also have basically any of the other directories that your application can, such as Config, Console, Lib, webroot, etc." - |
# |
May 27th 2021, 20:23 |
rightscoreanalysis |
I have a plugin which works and I call, I have put a die() at the top of myplugin/Config/routes.php and core.php but execution does not die - how is that possible? |
# |
May 27th 2021, 20:14 |
rightscoreanalysis |
seems the core.php and routes.php within a plugin are not read for some reason |
# |
May 27th 2021, 19:46 |
rightscoreanalysis |
the book of prefix routing seems to be all about using /admn/foo/index to route to admin_index in foo controller - I guess that was a sensible option once upon a time? |
# |
May 27th 2021, 19:45 |
rightscoreanalysis |
anyone remember if it is possible to have controller in subfolders in cake2 |
# |
May 27th 2021, 18:43 |
etibor |
very useful plugin |
# |
May 27th 2021, 18:42 |
kevin.pfeifer |
nope |
# |
May 27th 2021, 18:42 |
etibor |
have you ever worked with cakepdf? |
# |
May 27th 2021, 18:42 |
etibor |
thank you @kevin.pfeifer |
# |
May 27th 2021, 18:42 |
kevin.pfeifer |
but I could be wrong and there is some way to do what you want |
# |
May 27th 2021, 18:42 |
etibor |
yes simple often faster solution :) |
# |
May 27th 2021, 18:41 |
kevin.pfeifer |
well prefixes are basically meant to have the connected controller logic to be present in a Sub-Namespaces inside Controllers. So if you already have a `clerk` prefix your controller for those routes live in the folder `src/Controller/clerk` and therefore live in another namespace (as well as the connected template files) I haven’t dealt with routes that often till now but I guess you would be faster to just put an |
# |
May 27th 2021, 18:41 |
slackebot |
.htaccess redirect from `/review/*` to `/clark/*` |
# |
May 27th 2021, 18:29 |
etibor |
yes that would be the case |
# |
May 27th 2021, 18:29 |
etibor |
hello @kevin.pfeifer |
# |
May 27th 2021, 12:45 |
kevin.pfeifer |
ah i mean `/review/somecontroller/someaction` as well as `/clerk/somecontroller/someaction` |
# |
May 27th 2021, 12:36 |
kevin.pfeifer |
so you want to have the same result with either `/review/someaction` as well as `/clerk/someaction` |
# |
May 27th 2021, 12:17 |
etibor |
does not seems its enough |
# |
May 27th 2021, 12:17 |
etibor |
`$routes->connect('/review/*', ['prefix'=>'clerk']);` |
# |
May 27th 2021, 12:16 |
etibor |
i would like to redirect one prefix to another prefix(with all actions and views) |
# |
May 27th 2021, 12:16 |
etibor |
hello everyone |
# |
May 26th 2021, 22:12 |
tyler.adam.lazenby |
I finally figured it out, there is a nesting label template |
# |
May 26th 2021, 22:10 |
etibor |
its not avery good solution since i can not use those values in the Paginate |
# |
May 26th 2021, 22:10 |
etibor |
Kevin,ndm thank you for your help, i implemented in not a smooth way, i made a pre query to determine if it is a clerk or a secreter than made the second query , and attached to the main query in the index controller by using $results->map |
# |
May 26th 2021, 22:01 |
tyler.adam.lazenby |
how can I change that |
# |
May 26th 2021, 21:59 |
tyler.adam.lazenby |
Boo is just so I can easily inpect it |