# |
May 6th 2021, 06:34 |
kevin.pfeifer |
and you answerd with `moment/moment` |
# |
May 6th 2021, 06:34 |
slackebot |
<kevin.pfeifer> |
# |
May 6th 2021, 06:34 |
kevin.pfeifer |
well I asked you yesterday |
# |
May 6th 2021, 06:32 |
slackebot |
re-download packages in th vendor dir this time. The behavior, if this package is required by a library we need, is "unpredictable". That's my problem ;) The solution ? use npm, you certainly right, and i will, but behavior still there. |
# |
May 6th 2021, 06:32 |
erwane |
@admad and @kevin.pfeifer i'm not using an old package with an old dependents. moment/moment is still maintained and switch from robloach/component-installer to oomphinc/composer-installers-extender for servers without npm. The question is about : why first install (without a composer.lock), the `Plugin` dir is well created, `composer/installers` do the job, but packages not recognized. And a second `composer install` |
# |
May 5th 2021, 22:17 |
me1367 |
Otherwise, it's a problem for future me |
# |
May 5th 2021, 22:17 |
me1367 |
Well, let's hope not caching it won't F over my entire performance :^) |
# |
May 5th 2021, 22:12 |
ndm |
That middleware object isn't serializable, so you can't cache it. There's not a lot you can do, other than not binding the middleware in your routes (and for example use a custom middleware that checks the request and applies your other middleware), or not using caching. |
# |
May 5th 2021, 22:06 |
me1367 |
Mainly just questions. We tend to do the "general chat" in random |
# |
May 5th 2021, 22:06 |
virtudavi99 |
Um is this the best channel for general chat? Or is this just for questions? |
# |
May 5th 2021, 22:03 |
me1367 |
FileEngine has the same error... It works if I disable the routing cache but idk if that's a good idea... |
# |
May 5th 2021, 21:49 |
me1367 |
Error seems to be while adding it to the `plugin.php` |
# |
May 5th 2021, 21:45 |
slackebot |
'/graphql'],function ($routes) { $routes->scope('/', function(RouteBuilder $routes) { $routes->applyMiddleware('bodyParser'); $routes->connect('/', ['plugin' => 'Admiral/GraphQL', 'controller' => 'Graphql', 'action' => 'index', '_name' => 'graphql']); }); $routes->fallbacks(DashedRoute::class); });``` But now I get the error: `Exception: Serialization of 'Closure' is not allowed` In the ApcuEngine... |
# |
May 5th 2021, 21:45 |
me1367 |
hmm... added this to my `plugin.php`: ```public function routes(RouteBuilder $routes): void { // Add BodyParserMiddleware $routes->registerMiddleware('bodyParser', new BodyParserMiddleware()); // Add routes. // By default will load `config/routes.php` in the plugin. parent::routes($routes); }``` And this to my `routes.php` (of the same plugin): ```Router::plugin('Admiral/GraphQL', ['path' => |
# |
May 5th 2021, 21:26 |
me1367 |
oh, I see a lot more stuff in here that's interesting for later *creepy laughter* |
# |
May 5th 2021, 21:26 |
me1367 |
ah |
# |
May 5th 2021, 21:24 |
ndm |
body parser middleware |
# |
May 5th 2021, 21:20 |
me1367 |
So, it appears I can't get POST data anymore? The following code returns an empty array in Xdebug... ```$this->getRequest()->getData();``` In Insomnia, however, I can see it being a POST request *and* it sending a body just fine... |
# |
May 5th 2021, 20:30 |
tyler.adam.lazenby |
As well as create a script that makes the attempt to remove it on success. |
# |
May 5th 2021, 20:29 |
tyler.adam.lazenby |
I have thought about handling the upload seperately, but I hadn't thought about the temp storage idea. I could do that. And then to be safe I would just have a queue job make sure that file itself is cleaned out after a while. |
# |
May 5th 2021, 20:17 |
ndm |
There's variants of basically one and the same concept, which is to temporarily store the (valid) file using a unique identifier, and then just pass around that identifier, and use it to finalize/publish the upload once the form data has been successfully saved. Handling the upload separately and immediately via AJAX is also pretty popular. |
# |
May 5th 2021, 20:00 |
slackebot |
->first(); $this->set(compact('account', 'users', 'states', 'mailing_type', 'billing_type')); return null; }``` |
# |
May 5th 2021, 20:00 |
slackebot |
account could not be saved. Please, try again.')); } $users = $this->Accounts->Users->find('list', ['limit' => 200]); $states = $this->Accounts->Addresses->States->find('list'); $mailing_type = $this->Accounts->Addresses->AddressTypes->find() ->where(['name' => 'mailing']) ->first(); $billing_type = $this->Accounts->Addresses->AddressTypes->find() ->where(['name' => 'billing']) |
# |
May 5th 2021, 20:00 |
slackebot |
process the file.'); $this->log($e->getMessage()); $this->log($e->getTraceAsString()); } $account = $this->Accounts->patchEntity($account, ['logo' => $result['ObjectURL']]); if ($this->Accounts->save($account)) { $this->Flash->success(__('The account has been saved.')); return $this->redirect(['action' => 'index']); } $this->Flash->error(__('The |
# |
May 5th 2021, 20:00 |
slackebot |
$this->Authorization->authorize($account); if ($this->request->is(['patch', 'post', 'put'])) { $account = $this->Accounts->patchEntity($account, $this->request->getData()); try { $result = $this->AWS->createFile($this->request->getUploadedFile('logo')) ?? ['ObjectURL' => $logo]; } catch (UploadedFileErrorException $e) { $result['ObjectURL'] = $logo; $this->log('Could not |
# |
May 5th 2021, 20:00 |
tyler.adam.lazenby |
```/** * Edit method * * @param string|null $id Account id. * @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise. * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. */ public function edit(?string $id = null): ?\Cake\Http\Response { $account = $this->Accounts->get($id); $logo = $account->logo; |
# |
May 5th 2021, 19:56 |
slackebot |
if the validations on the front end are disabled, be able to make that logo file upload keep that same file so that they don't have to upload the same file over and over again |
# |
May 5th 2021, 19:56 |
tyler.adam.lazenby |
How would you go about making a logo image upload sticky on the form when the table is meant to store its URL (the logo is uploaded to the webserver and then from there passed to AWS into an s3 bucket and then we store the s3 bucket object url). The name of the file when uploaded gets changed to a securely random name with the mimetype extension. My question is how do you make it so that the system will for example, |
# |
May 5th 2021, 17:27 |
kevin.pfeifer |
na it should |
# |
May 5th 2021, 17:27 |
kevin.pfeifer |
:thinking_face: |
# |
May 5th 2021, 17:26 |
kevin.pfeifer |
oh wait, i guess >= 3.0.0 in the composer constraints don't work when you have 4.0 |
# |
May 5th 2021, 17:22 |
kevin.pfeifer |
but still I dont understand why this composer/installer plugin should install it in the wrong directory. https://github.com/composer/installers/blob/main/src/Composer/Installers/CakePHPInstaller.php#L38 checks for cakephp version >= 3.0.0 |
# |
May 5th 2021, 17:15 |
admad |
Asking the right questions @kevin.pfeifer :) |
# |
May 5th 2021, 17:02 |
kevin.pfeifer |
hmmm, what is easier: change the whole cakephp 3 and 4 plugin ecosystem or tell you to not use an old library which requires an old composer installer module which causes problems :thinking_face: |
# |
May 5th 2021, 16:56 |
erwane |
maybe plugins writed for cakephp 3 and 4 should change `"type": "cakephp-plugin",` to `"type": "library",` |
# |
May 5th 2021, 16:54 |
admad |
`composer/installers` was need for plugins in Cake 2, which is why it tries to install in `Plugin` dir |
# |
May 5th 2021, 16:51 |
erwane |
yes, i will remove this requirements. But i'm really curious about this behavior. Maybe CakePHP team can answer it |
# |
May 5th 2021, 16:50 |
kevin.pfeifer |
i still stand by the fact, that you should handle JS Library dependencies via npm and not composer but otherwise I can't help you :man-shrugging: |
# |
May 5th 2021, 16:48 |
kevin.pfeifer |
mhmm but you dont have the plugin-installer active here |
# |
May 5th 2021, 16:46 |
kevin.pfeifer |
i guess it clashes with composer/installers |
# |
May 5th 2021, 16:46 |
kevin.pfeifer |
which handles how plugins are being managed inside the vendor folder |