Closed golusin closed 7 years ago
Sounds like a model alias issue to me. Although the file upload path doesn't seem logical to me either. I would have expected webroot/files/attachment/<field>/<id>/<files>
Yes, the path is exactly what you are expecting... <field>
in Attachment model where the filename is stored is named attachment.
I don't understand why shell script can't work with Image instead of Attachment when everything is working perfectly find when uploading files... all the records are created and files uploaded to app/webroot/files/image/attachment/<id>/
I'm not sure how to resolve this one :( Any ideas?
Probably just needs a PR to use an alias()
call on the Model.
Although it does use loadModel()
so it should be taking care of aliases already.
Then it seems clear that your model class cannot be loaded and doesn't have the behaviour attached. Still seems like an issue with the class aliases to me.
I've not tried it with aliases as I don't tend to use them, sorry.
loadModel
won't load the model from an association alias. You'll need to make a change to add alias support. I'll gladly accept a pull request, but as CakePHP 2.x is not the current stable version, I won't be fixing this in mainline on my own.
I'm trying to regenerate thumbnails for all the Product records. However, shell script doesn't do anything, apparently due to model naming problem.
I'm using CakePHP 2.8.6 and here are two models related to this issue.
Attachment
and Product
When I try to run shell script and put Image as model name, I get
Model 'Image' not found.
error message. However, when I put Attachment as model name, script fails to find the files. All the files are uploaded toapp/webroot/files/image/attachment/*
. When I output$sourceFilePath
variable inThumbnailShell.php
shell script I can see that the script is looking for them atapp/webroot/files/attachment/attachment/*
.Can anybody help me to resolve this one :(