# |
Jul 24th 2018, 10:24 |
turkles |
does the data have some relation to the controller you end up at? If not I'd be looking at doing something in the AppController to fetch it, and then set in beforeRender perhaps |
# |
Jul 24th 2018, 10:18 |
bernat |
a request parameter |
# |
Jul 24th 2018, 10:18 |
bernat |
My first guess is setting it as a parameter in a route object. |
# |
Jul 24th 2018, 10:17 |
bernat |
Hi. I need some data in my app (controllers and views) that is not in the request but it's inferred from it. It's usually some entity read from the database that changes depending on a URL prefix. How do you store this kind of data to be available along the request processing path? |
# |
Jul 24th 2018, 10:16 |
dereuromark |
firstname+lastname or email unique goes out the window usually :slightly_smiling_face: |
# |
Jul 24th 2018, 10:16 |
dereuromark |
just dangerous to use cs as default for human input which by its definition is ci in 99% of all cases, creating inconsistencies everywhere. and most people dont know. |
# |
Jul 24th 2018, 10:15 |
dereuromark |
true |
# |
Jul 24th 2018, 10:15 |
lorenzo |
that would be the same in mysql, though |
# |
Jul 24th 2018, 10:15 |
dereuromark |
well, doesnt matter now :slightly_smiling_face: |
# |
Jul 24th 2018, 10:15 |
dereuromark |
but there were other real issues afaik |
# |
Jul 24th 2018, 10:15 |
slackebot |
the data as citext and explicitly casting the column to text when you want case-sensitive comparison. In either situation, you will need two indexes if you want both types of searches to be fast." |
# |
Jul 24th 2018, 10:15 |
dereuromark |
"citext doesn't help much if you need data to compare case-sensitively in some contexts and case-insensitively in other contexts. The standard answer is to use the text type and manually use the lower function when you need to compare case-insensitively; this works all right if case-insensitive comparison is needed only infrequently. If you need case-insensitive behavior most of the time and case-sensitive infrequently, consider storing |
# |
Jul 24th 2018, 10:13 |
lorenzo |
it depends on the locale you have set for the database, though… that may have been your problem |
# |
Jul 24th 2018, 10:13 |
lorenzo |
it is just a text column with an attached condition |
# |
Jul 24th 2018, 10:13 |
lorenzo |
buggy in what way? I’ve never had an issue with it |
# |
Jul 24th 2018, 10:12 |
dereuromark |
citext column was buggy from what I remember |
# |
Jul 24th 2018, 10:11 |
lorenzo |
so droping the fk, should also drop the index |
# |
Jul 24th 2018, 10:11 |
neon1024 |
Sorry, but I don’t really understand enough about the problem to write an accurate issue |
# |
Jul 24th 2018, 10:11 |
lorenzo |
it does, but the index is controlled by the existence of the fk |
# |
Jul 24th 2018, 10:11 |
neon1024 |
Doesn’t a FK create an index? |
# |
Jul 24th 2018, 10:10 |
lorenzo |
you should open a ticket |
# |
Jul 24th 2018, 10:10 |
lorenzo |
@neon1024 if you told it to dpro the fk, but it attempted to drop an index instead, that’s a bug |
# |
Jul 24th 2018, 10:09 |
lorenzo |
ci= case insensitive |
# |
Jul 24th 2018, 10:09 |
lorenzo |
use a citext column type |
# |
Jul 24th 2018, 10:08 |
dereuromark |
lorenzo: how? it doesnt seem to be true |
# |
Jul 24th 2018, 10:08 |
lorenzo |
same as postgres can do both easily :P |
# |
Jul 24th 2018, 10:08 |
neon1024 |
I’m just changing the db directly |
# |
Jul 24th 2018, 10:08 |
dereuromark |
but meh/ |
# |
Jul 24th 2018, 10:08 |
dereuromark |
mysql can do both easily :slightly_smiling_face: |
# |
Jul 24th 2018, 10:08 |
neon1024 |
I’ve stopped using migrations now |
# |
Jul 24th 2018, 10:08 |
lorenzo |
yes, you have to be aware that it is case sensitive, unlike mysql |
# |
Jul 24th 2018, 10:08 |
neon1024 |
@lorenzo Yeah, stuff like `->dropForeignKey('script_id', 'slots_scripts_fk')` |
# |
Jul 24th 2018, 10:07 |
dereuromark |
best example: email addresses, tons of bugs because of this, partially even security issues |
# |
Jul 24th 2018, 10:07 |
lorenzo |
@neon1024 is it oyu trying to drop the index yourself? |
# |
Jul 24th 2018, 10:07 |
dereuromark |
haha, that by default this is a bad default for human input, and if you want to, there is no proper way here |
# |
Jul 24th 2018, 10:07 |
neon1024 |
Then a whole bunch of errors about invalid stream |
# |
Jul 24th 2018, 10:07 |
lorenzo |
@dereuromark you mean that it is properly case sensitive? |
# |
Jul 24th 2018, 10:07 |
neon1024 |
You get this if a FK fails |
# |
Jul 24th 2018, 10:07 |
neon1024 |
File uploaded https://cakesf.slack.com/files/U1BT622HW/FBV4SHSV6/screen_shot_2018-07-24_at_11.06.40.png / https://slack-files.com/T053DPNCM-FBV4SHSV6-5ae4ed839e |
# |
Jul 24th 2018, 10:06 |
dereuromark |
only some buggy extension, i really dont like it |
# |
Jul 24th 2018, 10:06 |
dereuromark |
doesnt still have a proper working solution here |