cakephp-filesystem icon indicating copy to clipboard operation
cakephp-filesystem copied to clipboard

Formatter executed multiple times

Open alexvanniel opened this issue 4 years ago • 2 comments

I am not entirely sure if this is really an issue or just me not understanding what is happening. I have created my own formatter, this formatter is supposed to create a split path repository to minimize the number of files in a single directory. This works well, however, it appears that the getPath method from the formatter is called multiple times. What happens is that the split path is generated based on a generated UUID and this gets generated each time getPath is called leaving me with a mismatch between the path used and the path eventually returned. Now, I can ofcourse easily change this by passing the UUID in the data field to the formatter. I am just wondering if running the formatter might be unwanted behavior? So, maybe consider this as a request for infromation instead of an actual bug/issue report :)

alexvanniel avatar Apr 24 '20 08:04 alexvanniel

The getPath() method indeed returns the formatted path from the formatter, however you are making a good point, i did not consider your use case and will have to make some changes to get the path persistent after calling it for the first time before uploading.

I'll try to make some time for it in the coming week.

josbeir avatar Apr 24 '20 09:04 josbeir

That would be great. I have worked around it for now.

alexvanniel avatar Apr 24 '20 09:04 alexvanniel