# |
Jun 24th 2019, 16:35 |
daniel.upshaw |
Here's something super annoying |
# |
Jun 24th 2019, 16:17 |
daniel.upshaw |
Lol darn |
# |
Jun 24th 2019, 16:17 |
daniel.upshaw |
Oy |
# |
Jun 24th 2019, 16:17 |
a.didier |
i see... I'm on a really old project and i'm not really used to Cake2 and the previous dev did some weird stuff XD Hard to understand |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
`app/View/Recipes/search.ctp` |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
`app/View/Recipes/share.ctp` |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
`app/View/Recipes/view.ctp` |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
So each of `view`, `share`, `search` generates a response |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
```# /app/Controller/RecipesController.php class RecipesController extends AppController { public function view($id) { //action logic goes here.. } public function share($customerId, $recipeId) { //action logic goes here.. } public function search($query) { //action logic goes here.. } }``` |
# |
Jun 24th 2019, 16:14 |
daniel.upshaw |
Controller should automatically generate a response, but you can customize it first if you need to |
# |
Jun 24th 2019, 16:14 |
daniel.upshaw |
The response is probably from here: https://book.cakephp.org/2.0/en/controllers.html |
# |
Jun 24th 2019, 16:13 |
daniel.upshaw |
So it would already know about `json` for example, so `type->('json')` is already prepared whereas as `vcf` needs `$this->response->type(array('vcf' => 'text/v-card'));` to be set first |
# |
Jun 24th 2019, 16:13 |
daniel.upshaw |
Although in the example, that's a custom one |
# |
Jun 24th 2019, 16:12 |
daniel.upshaw |
So by setting `type->('vcf');`, it's just adding the `text/v-card` MIME type to the headers |
# |
Jun 24th 2019, 16:12 |
daniel.upshaw |
@a.didier I think you can still use a template with a different response type |
# |
Jun 24th 2019, 16:02 |
a.didier |
Hello, quick question : I want to use CakeResponse on Cake2.10 but i have no idea on how to load it... The book show small code like this `$this->response->type('vcf');` nothing on how response is set... |
# |
Jun 24th 2019, 15:01 |
jeremyharris |
I believe the Croogo CMS has visual ACLs. I haven’t looked at it in a while but that might be a good example if they still have it |
# |
Jun 24th 2019, 14:59 |
feLiruc |
Hello guys... I need to implement ACL in a visual way for CakePHP 3.7, do you guys have any good source or tutorial to do that? |
# |
Jun 24th 2019, 14:03 |
jeremyharris |
I’m glad you got it working. I’ll try and set aside some time this week to see if I can make it automatically restore existing handlers somehow |
# |
Jun 24th 2019, 14:03 |
jeremyharris |
I don’t remember at the moment to be honest. I think all known cake-related state is cleaned so that the test cases have a clean state to work with |
# |
Jun 24th 2019, 13:27 |
madbbb |
what is the purpose of EventManager cleaning in default test case setUp() method? I don't get it. As you said I rewrote the setup method and now it works. thank you |
# |
Jun 24th 2019, 13:23 |
jeremyharris |
so your bootstrap will be run when the initial test suite runs, but you’ll need to re-add them in TestCase::setUp (I usually have a base test case class to do this in) so they are added for each test thereafter |
# |
Jun 24th 2019, 13:22 |
jeremyharris |
sorry, your test case setup I mean |
# |
Jun 24th 2019, 13:21 |
madbbb |
but I have require dirname(__DIR__) . '/config/bootstrap.php'; in my test bootstrap.php |
# |
Jun 24th 2019, 13:20 |
jeremyharris |
I think restoring them automatically might be possible, but I haven’t looked into it too much to set up a PR yet |
# |
Jun 24th 2019, 13:19 |
jeremyharris |
@madbbb you need to add them to your test bootstrap too; that’s what I do. |
# |
Jun 24th 2019, 13:09 |
madbbb |
TestCase.php creates new instance of EventManager in setUp() method. That is why I have no listeners anymore |
# |
Jun 24th 2019, 12:59 |
gourav |
Please give idea how I can fix this. |
# |
Jun 24th 2019, 12:59 |
gourav |
I am getting issue with two cake php versions 1.3 and 3.3, I want to login into cake 3.3 from 1.3 with manual auth setting, but It's not working I am using the curl for this purpose, |
# |
Jun 24th 2019, 12:57 |
gourav |
Hi EveryOne, |
# |
Jun 24th 2019, 12:57 |
madbbb |
but EventManager has no listeners in my models. |
# |
Jun 24th 2019, 12:51 |
slackebot |
initilizng in test env |
# |
Jun 24th 2019, 12:51 |
madbbb |
Hello. When I run tests my event listeners do not receive events. Is there some additional setup needed for them to work in test environment? I initialise them in bootstrap.php like this: ``` $listeners = [ App\Event\InvoiceListener::class, App\Event\OrderListener::class, App\Event\TransactionListener::class ]; foreach ($listeners as $listener) { EventManager::instance()->attach(new $listener()); } ``` look like they are not |
# |
Jun 24th 2019, 11:15 |
slackebot |
'cascadeCallbacks' => true, ]); And ControllableObject have the Behavior as: $this->addBehavior('Muffin/Trash.Trash'); When i delete a ControllableObject, the behavior add only the timestamp on this table, and the relationships table are ignored :S, someone can help? |
# |
Jun 24th 2019, 11:15 |
peppejaripappalardo |
Hi all, just a little question about Muffin/Trash soft-delete. I have these table: ControllableObjects => AbstractResources => Resources => Volunteers. When i delete a ControllableObject, it have to delete a cascade Abastract, Resources, Volunters. At this time these table have the ForeignKey as is required by the plugin. Every have the behavior with: $this->addBehavior('Muffin/Trash.Trash', [ 'dependent' => true, |
# |
Jun 24th 2019, 11:04 |
adithya |
why is withFile prepending to the path provided? |
# |
Jun 24th 2019, 11:03 |
adithya |
$file_path = WWW_ROOT.'img/file.txt'; $response = $this->response->withFile($file_path); I'm trying to serve this file but the url generated by the withFile is /users/demouser/websites/cakeproject1/src//users/demouser/websites/cakeproject1/webroot/img/file.txt what am i doing wrong? |
# |
Jun 24th 2019, 11:01 |
unclezoot |
i think this line is the problem ShellDispatcher::addShortPluginAliases(265). $aliases += [$shell => $plugin]; as it assumes that you will never have 2 shells with the same name |
# |
Jun 24th 2019, 11:00 |
vossen.steven |
it doesnt though since it checks if the plugins are the same |
# |
Jun 24th 2019, 10:59 |
adithya |
$file_path = WWW_ROOT.$path; $response = $this->response->withFile($file_path); |
# |
Jun 24th 2019, 10:52 |
unclezoot |
seems to be all sorts of array_flipping going on in there: $fixed = array_flip($list['app']) + array_flip($list['CORE']);, so if you have a shell called Reporting.utilities and Search.utilities say, then you'll fill up your debug.log in no time |