Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 07 2021 13:24
    dereuromark commented #46
  • Nov 09 2020 14:36
    jeffersonsimaogoncalves synchronize #46
  • Nov 09 2020 14:23
    jeffersonsimaogoncalves synchronize #46
  • Nov 09 2020 03:22
    jeffersonsimaogoncalves opened #46
  • Jul 05 2020 17:18
    Casmo commented #40
  • Jun 22 2020 14:04

    bobmulder on master

    Use 'fields' from CreatedBy or … (compare)

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

    martonmiklos on master

    Fix null pointer exception in W… (compare)

  • Jun 22 2020 12:59
    martonmiklos closed #45
  • Jun 22 2020 09:18
    coveralls commented #44
  • Jun 22 2020 09:16
    bancer synchronize #44
  • Jun 22 2020 09:13
    coveralls commented #45
  • Jun 22 2020 09:11
    bancer opened #45
  • Jan 28 2020 15:32
    bobmulder commented #44
  • Jan 28 2020 10:14
    coveralls commented #44
  • Jan 28 2020 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
Tomas Gonzalez
@Tomicapo
Yes, the problem is that when saving the path, it's saved with the DS instead of a slash "/" which is the correct character for a URL.
So when showing an image that was saved in a windows server, the path appears with a back slash "\" so the image can't be found by the browser.
Paul Vaughan
@vaughany

Isn't the DS constant set differently on different systems? So on my Debian server it's "/" and on Windows it would be "\"?

It sounds like you're saving the path as a string and therefore the / or \ is being saved also, but possibly incorrectly. You need to save the path without the slashes and build the path with the DS constant instead.

Tomas Gonzalez
@Tomicapo
1: Yes, that is correct.
2: The path is being saved by the behavior in this function:
protected function _setUploadColumns($entity, $field, $options = [])
{
    $fieldConfig = $this->config($field);
    $_upload = $this->_uploads[$field];

    // set all columns with values
    foreach ($fieldConfig['fields'] as $key => $column) {
        if ($column) {
            if ($key == "directory") {
                $entity->set($column, $this->_getPath($entity, $field, ['root' => false, 'file' => false]));
            }
            if ($key == "type") {
                $entity->set($column, $_upload['type']);
            }
            if ($key == "size") {
                $entity->set($column, $_upload['size']);
            }
            if ($key == "fileName") {
                $entity->set($column, $this->_getFileName($entity, $field, $options = []));
            }
            if ($key == "filePath") {
                $entity->set($column, $this->_getPath($entity, $field, ['root' => false, 'file' => true]));
            }
        }
    }
    return $entity;
}
I think...
The thing is that on the entity I'm getting the file path but not the URL path. And for showing the image I'd like to have the URL stored.
I apologize if my english is not very good... I'm from Argentina.
Bob Mulder
@bobmulder
Hi @Tomicapo. Sorry for the delay. I've been on holiday. What do you mean with the URL path? I think you can 'build' an url path using the file path?
Tomas Gonzalez
@Tomicapo

Hi, hope you enjoyed your holidays.

Let me show you an example:

  • I upload an image.
  • File path and name are stored in the entity. Ie: "uploads\static_pages\1\news-03.jpg" (notice the back slash "\" because of Windos OS).
  • When I want to display the image on the browser I have to change the back slash into a forward slash. Ie: domain.com/uploads/static_pages/1/news-03.jpg

So, whai we need is:

  • The URL so we can show it to the browser.
  • And the name and path of the file were we stored it (internal, OS dependant) in case we want to delete the file.
Bob Mulder
@bobmulder
In mean time this is done already? :)
Edwin
@EdwinKato
Hi Guys..Nid some help getting this to work..Any one online??
Bob Mulder
@bobmulder
Hey @Ugfighter, I'm here! If you want to report a bug, or discuss a new feature, you can do it here (vissible for everybody). If you need personal help just put it in a private chat with me, so we won't spam the rest ;)
Edwin
@EdwinKato
but i keep getting this errorError: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'avatar' cannot be null
Some one help
Bob Mulder
@bobmulder
Uhm I guess you have multiple columns called avatar in your database?
Edwin
@EdwinKato
Thanx @bobmulder ..You really helped me out
Bob Mulder
@bobmulder
:+1:
tuankiet2605
@tuankiet2605
Hello
everybody
I'm need help
I'm rebuild cakephp 3.x
I'm have problem about plugin cakemanager/cakephp-utils
I'm not know using this plugin
Please, help me via gmail: tuankiet2605@gmail.com
or skype: tuankiet2605
Thank you very much
Bob Mulder
@bobmulder
@tuankiet2605 hi, This chat is used to get he
Help or report problems. Please drop your issue here or chat me privately.
tuankiet2605
@tuankiet2605
Hello
Are you there?
Bob Mulder
@bobmulder
I am
MatthiasBusch
@MatthiasBusch
Hi guys
I am having trouble with the form forcing me to reupload my file everytime I update my model. Is there anything to prevent this?
Bob Mulder
@bobmulder
Hi @MatthiasBusch, can you give me some more details/error logs?
If you don't select a new file, it shouldn't be uploaded...
MatthiasBusch
@MatthiasBusch
I get the error, that the field image can't be left blank
so, the validation already fails, but if I disable the validation, the image path string will be overwritten
Bob Mulder
@bobmulder
That sounds very strange... Please drop me some info how to reproduce this so I can try it myself...
MatthiasBusch
@MatthiasBusch
sure, let me set something up
termlimit
@termlimit
once a user logs in, i am using GlobalAuth to get access to the id in a model. My question is how can i make my CakePHP models similar to this Laravel 4 call: $query = Auth::user()->accounts()->orderBy('accounts.name', 'ASC')
so i dont have to continuously get the user_id from the session, etc for each instance I need to check ownership
anybody getting up and getting out the of the house this weekend?
Bob Mulder
@bobmulder
hi @termlimit! just woke up, ill respond asap
Bob Mulder
@bobmulder
@termlimit you need to do something like $query = $this->Accounts()->find()->where(['Accounts.name' => Configure::read('GlobalAuth')['id']])
termlimit
@termlimit
@bobmulder thanks for the reply! I guess my question sucked. The goal I am aiming for is to use the User model class to perform ownership checks on specific calls. So something like $this->Users->Accounts->find('all') would only return the accounts specific to the logged in user. I could use a beforeFilter or before query call, but that can become restrictive if I don't want it.
I also thought about putting a custom finder method in the User model, that would add the user_id => Configure::read('GlobalAuth')['id'] to specific queries. I was going to try this later today. I think this may be the easiest way to reduce repeating the same call over and over again. Thanks for spurring my thoughts! Also, how do I mark code blocks here?
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'