# |
Jul 13th 2021, 15:45 |
kevin.pfeifer |
I can’t find any valid php function which is called `current_timestamp()` Or do you mean the MySQL function? |
# |
Jul 13th 2021, 15:41 |
tyler.adam.lazenby |
Is there a reason why the default value for datetime `current_timestamp()` is (a) generated by the snapshot command in migrations and (b) the system considers that invalid? |
# |
Jul 13th 2021, 14:59 |
tyler.adam.lazenby |
gosh dang it, I have to use an app_local file |
# |
Jul 13th 2021, 14:57 |
richard |
tired of doing sudo mysql then creating dbs/etc |
# |
Jul 13th 2021, 14:57 |
richard |
I was thinking as some sort of dev ops chain but honestly i haven’t done that either, it’s something i want to start doing more often though |
# |
Jul 13th 2021, 14:56 |
tyler.adam.lazenby |
init script huh? I have never done one of those |
# |
Jul 13th 2021, 14:55 |
richard |
also might be weird, yeah, so you’re better off just doing that part yourself as some sort of init script or something |
# |
Jul 13th 2021, 14:55 |
tyler.adam.lazenby |
yeah, but the thing about that is... migrations rufuses to run if it can't find a database connection |
# |
Jul 13th 2021, 14:55 |
richard |
i don’t think there is a db-agnostic way to do it though |
# |
Jul 13th 2021, 14:54 |
richard |
@tyler.adam.lazenby you can run any query in a migration technically, so yeah |
# |
Jul 13th 2021, 14:45 |
tyler.adam.lazenby |
so question... can migrations be programed to create a db or do I need to do that manually |
# |
Jul 13th 2021, 13:46 |
erwane |
If data are encoded with default flags, you can change it after i think. toPhp decode all data (escaped or not) toDatabase recode them with flags. I'm hot sure this should add bug. BUT this should be an option in JsonType, not default. |
# |
Jul 13th 2021, 13:43 |
dereuromark |
yeah, as expected the impact is rather small. but none the less, sounds like a more consistent data storage if done with the right flags from the beginning. one should however not change those in the middle (if data already exists). |
# |
Jul 13th 2021, 13:42 |
erwane |
```decode 1119 escaped: 0.001491s decode 1663 unescaped: 0.001954s``` |
# |
Jul 13th 2021, 13:42 |
erwane |
After more tests, not sure there is a large impact on speed. |
# |
Jul 13th 2021, 13:38 |
erwane |
weird result :S |
# |
Jul 13th 2021, 13:38 |
erwane |
with true datas : ```decode 1663 unescaped: 0.005169s decode 1119 escaped: 0.002547s``` |
# |
Jul 13th 2021, 13:14 |
erwane |
on 10'000 iteration but input is not random. Maybe internal php cache do the job. ```encode default: 0.335539s encode unescaped: 0.341111s decode escaped json: 0.426201s decode unescaped json: 0.410178s``` |
# |
Jul 13th 2021, 13:08 |
val |
but that doesn't work |
# |
Jul 13th 2021, 13:07 |
val |
I tried ``` $Query->getTypeMap() ->addDefaults([ 'Restaurant' => Restaurant::class, ]);``` |
# |
Jul 13th 2021, 13:02 |
val |
Hi, is there a way in Cake 3.x to tell the framework that the results of manual join in the query should be parsed as a model entity object (when there is no association to that's entity table)? |
# |
Jul 13th 2021, 12:17 |
dereuromark |
could be interesting to know also the impact of this - for a future default case one day as well |
# |
Jul 13th 2021, 12:17 |
dereuromark |
did you do a performance check here for lets say 1000 rows etc? |
# |
Jul 13th 2021, 12:17 |
dereuromark |
ok, sounds useful :) |
# |
Jul 13th 2021, 12:13 |
erwane |
@dereuromark cleaner json in an utf8 context (database tables encoding set to utf8 or utf8mb4). No need to escape everything i think. |
# |
Jul 13th 2021, 12:00 |
caseyw |
Thanks for that, I'll look into it! |
# |
Jul 13th 2021, 11:53 |
dereuromark |
I use it for font icons for example, to not have to search the correct names, but just to get the list of available ones. |
# |
Jul 13th 2021, 11:52 |
dereuromark |
e.g. any $this->Theme->get(..) etc would be able to give you a list of available magic strings, constants or alike to select from, at least in PHPStorm that works nicely. |
# |
Jul 13th 2021, 11:51 |
dereuromark |
I would also look into that for generating IDE specific meta data that can help to create auto complete lists. Most useful for magic strings. But also for a list of classes or constants on those. |
# |
Jul 13th 2021, 11:50 |
dereuromark |
Plugin::path() is for plugins usually, see how IdeHelper detects paths here for the plugins available. |
# |
Jul 13th 2021, 11:46 |
slackebot2 |
probably something outside the general support scope. |
# |
Jul 13th 2021, 11:46 |
caseyw |
Yeah, sorry I was just meaning an example. In our system as new themes are created an old one is typically duplicated and some things change while most remain the same. I was hoping to have a dynamic way of calling the plugin specific constant without having to know the name of the Plugin itself. Someone messaged me and said App::path() might help to know the plugin dynamically, but I don't see how that would. Anyway, this is |
# |
Jul 13th 2021, 11:42 |
dereuromark |
No, not with constants. They usually use ClassName::CONST_NAME syntax, which requires use statements. You could build a helper that does that though. Thats how I wrapped some things like Configure to be more easily accessible in the view (See Shim plugin). |
# |
Jul 13th 2021, 11:19 |
caseyw |
Ok, thanks. As far as accessing the class is there a way to initialize it into the view to make use easier? $this->ConstantClass->MARK ? |
# |
Jul 13th 2021, 10:41 |
dereuromark |
this is quite a specific case. I guess you could create some ConstantInterface that defines those, if there are different groups I suggest naming the interfaces accordingly. |
# |
Jul 13th 2021, 10:39 |
caseyw |
Hello all! I’m our software we have a number of plugins our team has made for mainly new themes, etc. im looking to create some constants on the plugin level to share in the ctp files of the plugin who owns it. Where’s the best place to setup general plugin specific constants? Im doing away with a bunch of magic numbers, etc. this is in Cake 3.9. |
# |
Jul 13th 2021, 10:19 |
paolo.bragagni |
probably I'm done |
# |
Jul 13th 2021, 10:16 |
paolo.bragagni |
mmm didnt understand |
# |
Jul 13th 2021, 10:15 |
dereuromark |
just remember all aliases you encountered, as they must be unique. |
# |
Jul 13th 2021, 10:15 |
paolo.bragagni |
I could cycle in associations but I'd like to make one only cicle |
# |
Jul 13th 2021, 10:14 |
paolo.bragagni |
how to know if the relation is BelongsToMany or HasMany in the cycle? |