# |
Jun 30th 2021, 22:18 |
rightscoreanalysis |
ah because my method was statc :) |
# |
Jun 30th 2021, 22:18 |
rightscoreanalysis |
Using $this when not in object context |
# |
Jun 30th 2021, 22:17 |
rightscoreanalysis |
I did the same: protected $_credentials; then using $this->_crednetialsd |
# |
Jun 30th 2021, 22:17 |
rightscoreanalysis |
in the core I can see: protected $_validCiphers = ['aes']; used as: $this->$_validCiphers |
# |
Jun 30th 2021, 20:07 |
kevin.pfeifer |
basically PSR-4 says, that a namespace has to correspond with the folder-structure the class is located |
# |
Jun 30th 2021, 20:06 |
kevin.pfeifer |
and yes, there is the whole psr-4 autloading standard as well if you want to read into that as well (which you definitely don't need to) https://www.php-fig.org/psr/psr-4/ |
# |
Jun 30th 2021, 20:05 |
kevin.pfeifer |
here for the app src directory https://github.com/cakephp/app/blob/master/composer.json#L29 |
# |
Jun 30th 2021, 20:05 |
kevin.pfeifer |
and the same goes for the cakephp core, but just with another namepsace https://github.com/cakephp/cakephp/blob/master/composer.json#L75 |
# |
Jun 30th 2021, 20:05 |
rightscoreanalysis |
awesome thanks for the pointers |
# |
Jun 30th 2021, 20:04 |
kevin.pfeifer |
well evertyhing in your `src` directory starts with `\App` because of what is defined in the composer.json |
# |
Jun 30th 2021, 20:04 |
rightscoreanalysis |
I guess I can also refer to the Utility classes in the cake core |
# |
Jun 30th 2021, 20:04 |
kevin.pfeifer |
well its the combo of namespacing with autoloading which composer automatically does https://www.php.net/manual/en/language.oop5.autoload.php |
# |
Jun 30th 2021, 20:03 |
kevin.pfeifer |
https://www.php.net/manual/en/language.namespaces.basics.php |
# |
Jun 30th 2021, 20:03 |
rightscoreanalysis |
yeah i have been on a cake2 project for some time so I had to un-learn a lot :) |
# |
Jun 30th 2021, 20:02 |
greg138 |
That old plugin seems to be about making Twitter "look like" a database, which seems like an abstraction that's not particularly useful. |
# |
Jun 30th 2021, 20:02 |
kevin.pfeifer |
and yes, cakephp has nothing to do with that |
# |
Jun 30th 2021, 20:02 |
kevin.pfeifer |
thats the magic of PHP namespaces ;) |
# |
Jun 30th 2021, 20:02 |
greg138 |
CakePHP is just PHP... |
# |
Jun 30th 2021, 20:02 |
rightscoreanalysis |
oh nice didn't realise that was possible |
# |
Jun 30th 2021, 20:01 |
kevin.pfeifer |
either statically or create an object, however you like |
# |
Jun 30th 2021, 20:01 |
kevin.pfeifer |
well then create a generic PHP class in `src/Utility/MyTwitter.php` , give it a namespace `App\Utility` And call it anywhere you like in your app with `\App\Utility\MyTwitter` |
# |
Jun 30th 2021, 20:00 |
rightscoreanalysis |
can helpers work on the backend - in Cake I mostly see them used in the template files |
# |
Jun 30th 2021, 19:59 |
rightscoreanalysis |
I guess so yes - if it was a model $this->TwitterApi->send($foo) typ of thing |
# |
Jun 30th 2021, 19:58 |
kevin.pfeifer |
so you basically want a Helper Class which serves you as an helper between the Twitter PHP API and your app? |
# |
Jun 30th 2021, 19:57 |
rightscoreanalysis |
https://github.com/cakephp/cakephp/issues/5390 |
# |
Jun 30th 2021, 19:57 |
greg138 |
Oh, sorry, table-less models, not model-less forms... |
# |
Jun 30th 2021, 19:56 |
greg138 |
Where did you read that about Cake3? https://book.cakephp.org/3/en/core-libraries/form.html |
# |
Jun 30th 2021, 19:55 |
rightscoreanalysis |
component is not applicable, a plugin would not solve this, not sure that it is a behaviour |
# |
Jun 30th 2021, 19:55 |
rightscoreanalysis |
so I am wondering how I can implement something similar in Cake4 |
# |
Jun 30th 2021, 19:53 |
rightscoreanalysis |
I read that since cake3 it is no longer possible to use the table-less models |
# |
Jun 30th 2021, 19:53 |
rightscoreanalysis |
I am modifying an old Cake2 plugin that integrates with Twitter's API. In the old plugin there is a model file: https://github.com/voycey/cakephp-twitter-api/blob/master/Model/Twitter.php |
# |
Jun 30th 2021, 15:41 |
gutocf |
Hello, I'm trying to create fixtures with the vierge-noire/cakephp-fixture-factories plugin for a belongs to many association with data on the join table, but i didn't find how. Can someone help me with this? |
# |
Jun 30th 2021, 15:12 |
martin |
but in most cases it is not a problem I guess |
# |
Jun 30th 2021, 15:11 |
martin |
or a setting on patchEntity? |
# |
Jun 30th 2021, 14:51 |
dereuromark |
Do we need a patchIfModified() one? |
# |
Jun 30th 2021, 14:40 |
ndm |
Can you maybe supply a small example setup? I'm wondering whether the check in the core might be a bit to strict, or if it's actually a configuration issue. |
# |
Jun 30th 2021, 14:38 |
martin |
ok, I wanted to not send update to endpoint when fields are not changed, but I patch the full array, now I only patch the fields that are changed |
# |
Jun 30th 2021, 14:36 |
ndm |
patching a field will always mark it as dirty, no matter whether the content is identical |
# |
Jun 30th 2021, 14:35 |
ndm |
I probably shouldn't have said "target", given that this is a special term in associations. I really just ment the table class for the association alias. Associations aren't singletons like tables, so different targets should generally be no problem, as that's association config, not table config. |
# |
Jun 30th 2021, 14:35 |
martin |
or does that only happen with the webservice. that is also possible, I see dirty fields but original is empty |
# |
Jun 30th 2021, 14:26 |
martin |
hmm does PatchEntity also makes fields dirty that are not changed, I was thinking it would only make a field dirty when it is really changed |