# |
Aug 28th 2019, 07:22 |
admad |
`withBody()` could have had a wider argument type which converted a resource instance into StreamInterface instance :P |
# |
Aug 28th 2019, 07:19 |
spriz |
so I'll forgive you on that one ;P |
# |
Aug 28th 2019, 07:19 |
spriz |
I was looking for `withStream` by reflex anyway :) |
# |
Aug 28th 2019, 07:19 |
admad |
i had a n00b moment, Response doesn't have any `set*` method (expect deprecated ones maybe) |
# |
Aug 28th 2019, 07:18 |
spriz |
grrrrrrrrreat |
# |
Aug 28th 2019, 07:18 |
spriz |
No worries, this is much better! And it also keeps memory usage down |
# |
Aug 28th 2019, 07:17 |
admad |
sorry, no such method :P |
# |
Aug 28th 2019, 07:17 |
spriz |
or did I misunderstand? |
# |
Aug 28th 2019, 07:17 |
spriz |
I don't see such method @admad: https://api.cakephp.org/3.8/class-Cake.Http.Response.html |
# |
Aug 28th 2019, 07:16 |
admad |
or maybe just `$response->setStream($fileStream)` might work |
# |
Aug 28th 2019, 07:16 |
spriz |
Thanks a lot, that has been bugging me... Facepalm ,:) |
# |
Aug 28th 2019, 07:15 |
spriz |
Works @admad! |
# |
Aug 28th 2019, 07:15 |
spriz |
will try right awya |
# |
Aug 28th 2019, 07:15 |
spriz |
Aha! Of course |
# |
Aug 28th 2019, 07:15 |
admad |
just avoiding the use of CallbackStream |
# |
Aug 28th 2019, 07:14 |
admad |
so you can try passing your `$fileStream` to it |
# |
Aug 28th 2019, 07:14 |
admad |
@spriz Zend\Diactoros\Stream does take a stream as constructor argument. |
# |
Aug 28th 2019, 07:11 |
admad |
np |
# |
Aug 28th 2019, 07:11 |
javier.villanueva |
yes, sorry |
# |
Aug 28th 2019, 07:10 |
admad |
@javier.villanueva welcome, in future please use one of the help forums first before opening a GH issue for support :slightly_smiling_face: |
# |
Aug 28th 2019, 07:03 |
javier.villanueva |
@admad you were right. I disable adminlte and works. thanks a lot |
# |
Aug 28th 2019, 07:02 |
alexdd55976 |
morning fellaws |
# |
Aug 28th 2019, 07:00 |
spriz |
This is how I usually do this: https://gist.github.com/Spriz/a3ac5789283454373436cb979539fa94. Any chance I can avoid the `new CallbackStream`? :thinking_face: |
# |
Aug 28th 2019, 06:59 |
spriz |
What is your preferred way to serve file downloads (this case CSV) to users? They are on S3 currently - isn't reading the file as stream and serving that the most efficient? :slightly_smiling_face: |
# |
Aug 28th 2019, 06:51 |
javier.villanueva |
ok |
# |
Aug 28th 2019, 06:50 |
admad |
the problem is with your setup not the plugin |
# |
Aug 28th 2019, 06:50 |
javier.villanueva |
perfect |
# |
Aug 28th 2019, 06:50 |
admad |
please close the issue you opened on GH :slightly_smiling_face: |
# |
Aug 28th 2019, 06:49 |
javier.villanueva |
ok, i will research in this way. Thanks admad |
# |
Aug 28th 2019, 06:49 |
admad |
maybe by the adminlte plugin you are using |
# |
Aug 28th 2019, 06:49 |
admad |
these `'CsvView.Csv'` view class you set it getting reset, |
# |
Aug 28th 2019, 06:47 |
slackebot2 |
<javier.villanueva> |
# |
Aug 28th 2019, 06:46 |
admad |
show the full error message, along with the paths it checked in |
# |
Aug 28th 2019, 06:44 |
javier.villanueva |
public function export() { $data = [ ['a', 'b', 'c'], [1, 2, 3], ['you', 'and', 'me'], ]; $_serialize = 'data'; $this->setResponse($this->getResponse()->withDownload('inventory.csv')); $this->viewBuilder()->setClassName('CsvView.Csv'); $this->set(compact('data', '_serialize')); } |
# |
Aug 28th 2019, 06:44 |
admad |
show your method code |
# |
Aug 28th 2019, 06:34 |
javier.villanueva |
I am trying to export to csv file an entity list. I have used FriendsOfCake/cakephp-csvview with their most basic example, but always instead download file I have a "missing template export.ctp" error. Anyone could help me? Thanks |
# |
Aug 28th 2019, 06:32 |
javier.villanueva |
hi all |
# |
Aug 28th 2019, 06:12 |
admad |
yes setting up the auth libs will be a bit more involved |
# |
Aug 28th 2019, 06:10 |
challgren |
I'll have to look a bit more most of the time I just use cakedc users so I don't have to think as much |
# |
Aug 28th 2019, 06:09 |
challgren |
Well wondering the right approach |
# |
Aug 28th 2019, 04:39 |
admad |
Even if someone hasn't you still can :slightly_smiling_face: |