# |
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? |
# |
Jul 13th 2021, 10:14 |
dereuromark |
@erwane on the other side. Why does it need special ones? invalid syntax ignore maybe, but otherwise: as long as the same Type class is reading it again it shouldn't be a big deal |
# |
Jul 13th 2021, 10:13 |
paolo.bragagni |
and then it cyclea trough {% for alias, details in relations %} |
# |
Jul 13th 2021, 10:13 |
paolo.bragagni |
there is {% set relations = associations.BelongsToMany|merge(associations.HasMany) %} |
# |
Jul 13th 2021, 10:13 |
paolo.bragagni |
in view.twig |
# |
Jul 13th 2021, 10:13 |
paolo.bragagni |
cant go ahead in my problem.. :S |
# |
Jul 13th 2021, 10:12 |
dereuromark |
@erwane sounds like it, yeah |
# |
Jul 13th 2021, 09:50 |
charolastra |
sorry, looks like i've forgot to update setPrimaryKey() |
# |
Jul 13th 2021, 09:44 |
charolastra |
on a table with a composite key consiting of 3 fields a newEntity->save() updates an existent entity (where the 3rd key component is a boolean) instead of persisting the new one. not even doing something like $newScreening = $screening. what's going on? |
# |
Jul 13th 2021, 09:29 |
erwane |
Hi. It's a good idea to PR the `Database\Type\JsonType::toDatabase()` to allows options for json_encode like ` ```JSON_UNESCAPED_UNICODE + JSON_INVALID_UTF8_IGNORE + JSON_UNESCAPED_SLASHES``` Maybe via static `JsonType::setJsonEncodeOptions(int value)` |
# |
Jul 12th 2021, 20:24 |
kevin.pfeifer |
oh wow, the cookbook is build via the python library `cakephpsphinx` :cold_sweat: |
# |
Jul 12th 2021, 19:59 |
tyler.adam.lazenby |
are you using cannoical links with your cakephp website? |
# |
Jul 12th 2021, 19:57 |
tyler.adam.lazenby |
the company name is deprecated btw, so don't @ me for that |
# |
Jul 12th 2021, 19:57 |
tyler.adam.lazenby |
```if ($this->request->is(['POST', 'PUT'])) { $data = $this->request->getData(); $data['account_id'] = $current_user->account_id; $data['company_name'] = $current_user->account->name; $data['token'] = Security::randomString();``` ... |
# |
Jul 12th 2021, 19:57 |
tyler.adam.lazenby |
well this way works for now |
# |
Jul 12th 2021, 19:56 |
kevin.pfeifer |
or jsut a Table method if its just for 1 table/entity type |
# |
Jul 12th 2021, 19:56 |
kevin.pfeifer |
you could make a behavior which populates you empty entites with a given set of default data |