# |
Jul 25th 2018, 12:35 |
josbeir |
best paste it as a snippet next time |
# |
Jul 25th 2018, 12:34 |
mark |
I have PHP 7.1.19-1+ubuntu14.04.1+deb.sury.org+1 |
# |
Jul 25th 2018, 12:34 |
slackebot |
\App\Model\Entity\Dealer[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = []) */ class DealersController extends AppController { /** * Index method * * @return \Cake\Http\Response|void */ use FilesystemAwareTrait; public function upload() { $fileEntity = $this->getFilesystem('myfs')->upload($this->request->getData('upload')); debug($fileEntity); } |
# |
Jul 25th 2018, 12:34 |
mark |
cool. :) stuck on this one though, Error: syntax error, unexpected ':', expecting ';' or '{' File /home/cliper/rover/vendor/josbeir/cakephp-filesystem/src/FilesystemAwareTrait.php Line: 17 head of that code : <?php namespace App\Controller; use App\Controller\AppController; use Josbeir\Filesystem\FilesystemAwareTrait; /** * Dealers Controller * * @property \App\Model\Table\DealersTable $Dealers * * @method |
# |
Jul 25th 2018, 12:28 |
josbeir |
yeah traits :slightly_smiling_face: |
# |
Jul 25th 2018, 12:27 |
mark |
yep, right. let me try again now. actually, i just though of why there's two "use" statement .. and I never know we can do "use" inside a class? |
# |
Jul 25th 2018, 12:22 |
josbeir |
if you push an upload to your controller and capture the file data, pass it to the filesystem upload method it should return the uploaded file entity |
# |
Jul 25th 2018, 12:21 |
josbeir |
nothing wrong with the example |
# |
Jul 25th 2018, 12:21 |
mark |
maybe we can provide a practical use of it though? |
# |
Jul 25th 2018, 12:21 |
mark |
@josbeir yeah, wonder if we can do "use" next to that "AppController" |
# |
Jul 25th 2018, 12:21 |
mark |
yep, will try this one out to admad. :) |
# |
Jul 25th 2018, 12:10 |
josbeir |
yeah filesystem is a bit more abstract and requires more work to set up :slightly_smiling_face: |
# |
Jul 25th 2018, 12:09 |
admad |
@mark if you are looking for something more plug n play check out https://github.com/friendsofcake/cakephp-upload |
# |
Jul 25th 2018, 12:09 |
josbeir |
its just an example |
# |
Jul 25th 2018, 12:08 |
mark |
noice, im lost at this part though: namespace App\Controller; use Josbeir\Filesystem\FilesystemAwareTrait; class MyController extends AppController { use FilesystemAwareTrait; public function upload() |
# |
Jul 25th 2018, 12:05 |
josbeir |
added a little howto to use glide |
# |
Jul 25th 2018, 12:05 |
josbeir |
@mark https://github.com/josbeir/cakephp-filesystem/blob/master/README.md#extras |
# |
Jul 25th 2018, 11:56 |
mark |
RAD :) thanks much I'll look into this |
# |
Jul 25th 2018, 11:54 |
josbeir |
for the server and cache just use $this->getFilesystem()->getDisk(); (one for source and one for cache) |
# |
Jul 25th 2018, 11:54 |
josbeir |
https://github.com/ADmad/cakephp-glide that one |
# |
Jul 25th 2018, 11:53 |
josbeir |
i ment, glide plugin :) |
# |
Jul 25th 2018, 11:53 |
josbeir |
errr |
# |
Jul 25th 2018, 11:53 |
josbeir |
filesystem can be used to upload your images, image manipulation (thumbs, resizing, ..) can be done using @admad's flysystem plugin for example |
# |
Jul 25th 2018, 11:52 |
mark |
w00t! thank you josbeir you're right. was looking into using FilesystemAwareTrait, was stuborn earlier not sure where to start. |
# |
Jul 25th 2018, 11:51 |
josbeir |
that should be handled in your front end |
# |
Jul 25th 2018, 11:50 |
josbeir |
because 'drag and drop for images' has nothing to do with my plugins ... |
# |
Jul 25th 2018, 11:50 |
josbeir |
for drag en drop upload? |
# |
Jul 25th 2018, 11:50 |
josbeir |
@mark you mean something like dropzonejs ? |
# |
Jul 25th 2018, 11:43 |
mark |
cool |
# |
Jul 25th 2018, 11:43 |
chris-andre |
`$this->Form->select('organizations.0.id', $organizations, $options)` worked fine. Thanks @mark |
# |
Jul 25th 2018, 11:42 |
mark |
$this->Form->select('organizations.0.id', ['options' => $organizations]) |
# |
Jul 25th 2018, 11:42 |
mark |
and change it to ->select() |
# |
Jul 25th 2018, 11:41 |
mark |
try this instead: $this->Form->control('organizations.0.id', $organizations) |
# |
Jul 25th 2018, 11:41 |
chris-andre |
Contacts can add multiple Organizations, but one at a time |
# |
Jul 25th 2018, 11:41 |
mark |
you can try removing the array |
# |
Jul 25th 2018, 11:41 |
mark |
chris |
# |
Jul 25th 2018, 11:40 |
tim |
Yes. as such it's a multiple select. |
# |
Jul 25th 2018, 11:40 |
chris-andre |
@tim belongsToMany is the relation. Contacts belongsToMany Organizations and vice versa |
# |
Jul 25th 2018, 11:38 |
mark |
anybody recommends a simple drag and drop plugin for images? So far, no luck on https://github.com/josbeir/cakephp-filesystem and https://github.com/josbeir/cakephp-image |
# |
Jul 25th 2018, 11:38 |
tim |
belongsToMany is a multiple select? |
# |
Jul 25th 2018, 11:36 |
chris-andre |
Hi peeps. Contacts belongsToMany Organizations. When viewing a contact, you can add a organization to the contact. I have a general form `<?= $this->Form->create($contact) ?>`. But when adding the select, options are not shown `$this->Form->control('organizations.0.id', ['options' => $organizations])`. `organizations._ids` in first param works, but gives me multiple select. Is there a way around? |