# |
Jul 15th 2021, 05:22 |
greg138 |
I used to do it that way with Cake 1.3 apps, and it worked okay, more or less, but it did cause problems. And with the rearrangement of files for autoloading and PSR compliance in Cake 3+, it's much harder to do, and causes more problems to try it. Remember that the day you need to update Cake because you need support for some new plugin in one app, but can't update it because some old plugin in a different app doesn't work |
# |
Jul 15th 2021, 05:11 |
admad |
What's your reason for wanting to use only one vendor folder? |
# |
Jul 15th 2021, 04:08 |
davidmckenzie2015 |
I just don't want to have three (for example) cakephp core folders to support three cakephp webapps. Thanks again. |
# |
Jul 15th 2021, 04:07 |
davidmckenzie2015 |
Yes, I have read cakephp.org and implemented examples there. |
# |
Jul 15th 2021, 04:06 |
davidmckenzie2015 |
Thanks for getting back to me. Yes, I should have been more clear. I want to use a single cakephp install on the server and run multiple webapps from that same cakephp core set of files (e.g. the vendor folder, Bin, etc.) |
# |
Jul 15th 2021, 02:46 |
cnizzardini |
There is this for a more concrete example: https://github.com/gothinkster/cakephp-realworld-example-app |
# |
Jul 15th 2021, 02:44 |
cnizzardini |
Obviously you have read https://cakephp.org/ right? That is your best resource. |
# |
Jul 15th 2021, 02:43 |
cnizzardini |
Do you mean entirely different applications (i.e. different controllers, models etc.)? |
# |
Jul 15th 2021, 02:43 |
cnizzardini |
"host multiple apps" could mean a lot of things. |
# |
Jul 14th 2021, 23:01 |
davidmckenzie2015 |
Can someone please point me to online resources for how to manage cakephp on a production server and have it host multiple apps using the same cakephp core files (version)? I also need help making sure I place the files in the correct directories so that everything is secure. Thanks. |
# |
Jul 14th 2021, 16:39 |
rightscoreanalysis |
Am I correct in saying that $this->Model->getInsertId() is risky.... If user A makes a save and then user B makes a save right after, getInsertId is not going to be user A's insert id? the last insert id is the db connection or the current controller execution... this is Cake v2 btw |
# |
Jul 14th 2021, 15:59 |
tyler.adam.lazenby |
but good to see you |
# |
Jul 14th 2021, 15:59 |
tyler.adam.lazenby |
I was so confused |
# |
Jul 14th 2021, 15:59 |
cnizzardini |
oops wrong chat |
# |
Jul 14th 2021, 15:57 |
cnizzardini |
Did you try this instead: |
# |
Jul 14th 2021, 10:01 |
eax |
Found that solution on github not three minutes ago :P |
# |
Jul 14th 2021, 10:01 |
eax |
Thanks @matsaku! I ended up doing. this instead: `$this->ModelName->getEventManager()->off('Model.beforeSave');` |
# |
Jul 14th 2021, 09:55 |
kevin.pfeifer |
you can pass a custom option to your ```$articles->save($article, ['doNotBeforeSave' => false]);``` and check in your `beforeSave(EventInterface $event*,* EntityInterface $entity*,* ArrayObject $options)` function if that option is set and then just return true like ```if(!empty($options['doNotBeforeSave']) andand $options['doNotBeforeSave']) return true;``` |
# |
Jul 14th 2021, 09:46 |
eax |
Hey folks! Cake3 question: Can I disable a beforeSave event from a model somehow? I looked at the examples in the Cookbook but couldn’t make sense of how to apply them here :$ |
# |
Jul 14th 2021, 08:14 |
rudy1976s |
the listeners is set up in a plugin, I forgot to mention and it is loaded in the plugin.php of the plugin |
# |
Jul 14th 2021, 08:14 |
rudy1976s |
hello all ! I have a problem related to events that I was not yet able to manage: I have a controller action where I create an event and dispatch it: i cannot figure out why it randomly fires; i have a listener registered to that event. In the same controller I have another event, in another action which fires every time without any issue. |
# |
Jul 14th 2021, 07:19 |
dereuromark |
The existing alternatives are listed in https://github.com/FriendsOfCake/awesome-cakephp#queue |
# |
Jul 14th 2021, 07:17 |
dereuromark |
@gautam If you googled, and didnt find anything but that old core ticket, then the answer is most likely "not yet", but you could easily find existing libs out there (e.g. google finds https://github.com/lanlin/codeigniter-swoole ) and you could quickly port this to CakePHP and create a plugin for it yourself. |
# |
Jul 14th 2021, 03:53 |
hmic |
You will need to load the data yourself |
# |
Jul 14th 2021, 03:31 |
gautam |
Do we have any integration of swoole with cakephp? |
# |
Jul 14th 2021, 03:04 |
admad |
If the entity doesn't already have the related record you obviously need to load it yourself. |
# |
Jul 13th 2021, 23:20 |
rightscoreanalysis |
or do I have to load the model in the event and do a findbyid? |
# |
Jul 13th 2021, 22:55 |
rightscoreanalysis |
is this possible? |
# |
Jul 13th 2021, 22:55 |
rightscoreanalysis |
eg $entity->foo->title, but of course the entity only has foo_id |
# |
Jul 13th 2021, 22:54 |
rightscoreanalysis |
I have an event listener setup on my model save, but I need the title attribute of a related model... |
# |
Jul 13th 2021, 20:40 |
kevin.pfeifer |
would be a nice addition to https://book.cakephp.org/migrations/2/en/index.html |
# |
Jul 13th 2021, 20:39 |
greg138 |
I don't know if it's in the docs. It's in my code, but it might have gotten there by me searching the source, not the docs. :) |
# |
Jul 13th 2021, 20:20 |
dereuromark |
if this isnt in the docs, maybe it should be :) |
# |
Jul 13th 2021, 19:11 |
greg138 |
`$migrations = new \Migrations\Migrations();` `$migrations->seed(['plugin' => 'MyPlugin', 'seed' => 'MySeed']);` |
# |
Jul 13th 2021, 19:05 |
richard |
makes my life easier |
# |
Jul 13th 2021, 19:05 |
richard |
what i do is create a masterseed that runs all the other seeds, i also have checks in each seed so re-running won’t produce duplicate records |
# |
Jul 13th 2021, 18:28 |
devito |
is it possible to change the default layout of a plugin without modifying the plugin its self? |
# |
Jul 13th 2021, 17:48 |
tyler.adam.lazenby |
yeah |
# |
Jul 13th 2021, 17:48 |
dereuromark |
genius :) I would probably still prefer to have also a more code native way to run them. Might be worth a PR some day for someone. |
# |
Jul 13th 2021, 17:47 |
tyler.adam.lazenby |
```public function runSeed($name) { exec(join(DS, ['bin', 'cake']) . " migrations seed --seed=$name"); }``` |
# |
Jul 13th 2021, 17:47 |
tyler.adam.lazenby |
for me this works fine |