Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 05 17:18
    Casmo commented #40
  • Jun 22 14:04

    bobmulder on master

    Use 'fields' from CreatedBy or … (compare)

  • Jun 22 14:04
    bobmulder closed #44
  • Jun 22 12:59

    martonmiklos on master

    Fix null pointer exception in W… (compare)

  • Jun 22 12:59
    martonmiklos closed #45
  • Jun 22 09:18
    coveralls commented #44
  • Jun 22 09:16
    bancer synchronize #44
  • Jun 22 09:13
    coveralls commented #45
  • Jun 22 09:11
    bancer opened #45
  • Jan 28 15:32
    bobmulder commented #44
  • Jan 28 10:14
    coveralls commented #44
  • Jan 28 10:12
    bancer opened #44
  • Sep 19 2019 14:33
    martonmiklos closed #38
  • Sep 19 2019 14:33
    martonmiklos commented #38
  • Sep 19 2019 14:25
    martonmiklos closed #42
  • Sep 19 2019 14:25
    martonmiklos commented #42
  • Sep 19 2019 14:07
    martonmiklos added as member
  • Sep 19 2019 13:47
    bobmulder commented #43
  • Sep 19 2019 12:48
    martonmiklos commented #43
  • Sep 19 2019 12:32
    bancer commented #43
Bob Mulder
@bobmulder

@termlimit Gitter works with markdown. To create code-blocks you need to add 3 quotes who are above your Tab-button and before the 1-button. This quotes: ->`<- (haha, don't know how to explain :P). So add 3 quotes above your code, and after your code and your code will be shown in a block.

About your issue; I've always learned that Models should not handle ownership stuff. So in fact the model should not even know about roles and ownerships and stuff. And to be honest I agree with that. The GlobalAuth-behavior is just a thing to hack around it if you need it. So in your case you could create a custom finder as you mentioned. Your query-call would look like:

$this->Accounts()->find()->find('ownership', $userId);

I hope this will help you. Because this stuff isn't releated anymore to the utils-library I suggest you should contact me privately via Gitter if you have questions ;)

Have fun coding ;)

termlimit
@termlimit
@bobmulder thanks again for the awesome reply. I was worried it was out of the ballpark.
Mariano Paz
@mariano55555
Hi everyone...I need help with WhoDidIt behavior, I always get php Error: SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'CreatedBy'
Bob Mulder
@bobmulder
Anybody has this issue again? I've seens some more code, but couldn't find it...
mandeepkhaleriya08
@mandeepkhaleriya08
anybody can help me here ..How a user login with fb,gmail in cakephp 3.2?And how i do it
Bob Mulder
@bobmulder
I guess this is not a related question to this plugin, right @mandeepkhaleriya08 ?
Mateusz M
@micalmt_twitter
Hi. How would I correctly filter filenames before moving the uploaded file or saving its path in a DB?
For some reason I am cursed with having to remove \x09 from filenames, because users.
Bob Mulder
@bobmulder
Hi @micalmt_twitter, whats your issue exactly?
Mateusz M
@micalmt_twitter
Some of the files uploaded by my users somehow contain the tab character. I need to do something like str_replace("\x09", "\x20", $filename); on the uploaded file name, but I can't figure out how to do this properly (as in, without modyfing UploadableBehavior.php)
My guess is I need to look somewhere https://www.pastery.net/gxkqjg/ here
_shuffle() is just generating some random characters.
Bob Mulder
@bobmulder
Ah okay... And what would you do if you should modify the behavior? ;) Implementing an event would be useful I think? Are you familiar with that?
Mateusz M
@micalmt_twitter
Haven't done that in Cake, but I'm open to trying something new :)
Bob Mulder
@bobmulder
haha okay. My first thought was that you often would like to affect the progress... So take a look at http://book.cakephp.org/3.0/en/core-libraries/events.html. Maybe we can open a PR to implement some events to make it customizable for wishes like yours...
egadgetjnr
@egadgetjnr

Hi there,
I'm starting to wonder what I'm doing wrong and I think I'm starting to lose my hair (still fairly new to CakePHP)

I'm trying to implement the uploader and have followed all the documentation (at least I think I have) and it's failing to put the file where I tell it to but it IS updating the MYSQL Table with the required filename (although I would like it to put the full path. i.e. 'webroot/uploads/<username>/20160707.jpeg')

{{Code Follows}}

View Code (profile.ctp)
<?= $this->Form->create($user, array('role' => 'form')) ?> <div class="box-body"> <?php
//Profile Avatar Box echo $this->Html->image('avatar5.png', array('class' => 'img-thumbnail', 'alt' => 'User Image'));
//Upload new Avatar echo $this->Form->create($user, ['type' => 'file']);
echo $this->Form->input('avatar', ['type' => 'file']); echo $this->Form->input('username');
echo $this->Form->input('password'); echo $this->Form->input('name');
echo $this->Form->input('surname'); echo $this->Form->input('email');
echo $this->Form->input('mobile_number'); ?>
</div> <!-- /.box-body -->
<div class="box-footer"> <?= $this->Form->button(('Save')) ?>
</div> <?= $this->Form->end() ?>

Users Table
$this->addBehavior('Utils.Uploadable', [ 'avatar' => [
'field' => 'id', 'path' => '{ROOT}{DS}webroot{DS}uploads{DS}',
'fileName' => '{field}.{extension}' ],
` ]);

This message was deleted
egadgetjnr
@egadgetjnr
I think I may have found the issue. It's not creating the folder if it doesn't exist... Is there something I can do to fix that in terms of Validation?
Bob Mulder
@bobmulder
What OS are you working on @egadgetjnr?
egadgetjnr
@egadgetjnr
Windows ATM, but I've also tried it on Ubuntu
I ended up getting it to work by 'modifying' the Directory Checker (code following)
Bob Mulder
@bobmulder
Hm it sounds strange the folders aren't created automatically
egadgetjnr
@egadgetjnr
In UploadableBehavior:
//if (!is_dir($this->_getPath($entity, $field, ['root' => false, 'file' => false]))) {
        if(!file_exists($this->_getPath($entity, $field, ['root' => false, 'file' => false]))){
          $this->_mkdir($this->_getPath($entity, $field, ['root' => true, 'file' => false]), 0777, true);
       }
Sorry, I can't get the line breaks to work :(
Bob Mulder
@bobmulder
Google for markdown code block ;)
egadgetjnr
@egadgetjnr
MWHAHAH. I'm unstoppable now ;)
Bob Mulder
@bobmulder
Haha
I'm glad with it as well :p
mkdir should create the dir right?
Pat
@doonot
Hi Gentleman. Anyone around that can help me with Utils.Uploadable behaviour?
I am trying to save the filename to the "avatar" column in my database. But it always saves the whole path into that column:
Is this a bug?
content of avatar in my database after saving: files/workers/avatar/239/aNKK3YA_700b.jpg
Bob Mulder
@bobmulder
Probably this is no bug, but just the use of it @doonot...
Pat
@doonot
@bobmulder what am I doing wrong then?
Bob Mulder
@bobmulder
What do you want to reach @doonot?
Pat
@doonot
I only want to have „aNKK3YA_700b.jpg“ in the avatar column, not the whole path. Is this possible @bobmulder?
Pat
@doonot
no that is not what I meant… I know how to change the filename.
nevermind, I am going to search for another plugin. There is no help here anyway..
Pat
@doonot

$this->addBehavior('Utils.Uploadable', [ 'avatar' => [ 'path' => '{ROOT}{DS}{WEBROOT}{DS}files{DS}{model}{DS}avatar{DS}{field}{DS}', 'fields' => [ 'fileName' => 'avatar' ] ] ]);

But as this is not working, I would suggest you check it as it seems to be a bug to me. The docs say: fileName - this column contains the name of the file. For example: myFile.png. -> but the whole path is saved.

Bob Mulder
@bobmulder
@doonot the value of fileName should be {ORIGINAL}
Pat
@doonot
@bobmulder then it does not save the filename to the avatar column in the database.
Bob Mulder
@bobmulder
Oh sorry you're right
moshekamer1
@moshekamer1
Hi, there is plugin to bake with angular 2?
Sourjya Sankar Sen
@sourjya
Hi - with Cake 3.6, there is a deprecation notice for accessing the config variable directly in the WhoDidIt behavior. It is advised to use setConfig / getConfig directly.
Notice: Deprecated (16384): Utils\Model\Behavior\WhoDidItBehavior::config() is deprecated. Use setConfig()/getConfig() instead. - htdocs\my_project\vendor\cakemanager\cakephp-utils\src\Model\Behavior\WhoDidItBehavior.php, line: 69
this affects code from line 69 through 81
will any updates be released? I've modified the behavior directly to get rid of the error, but would be nice to see the updates in the master.