V8-archive: How to abort item creation?

Created on 22 Jul 2019  路  4Comments  路  Source: directus/v8-archive

I'm want to have the ability to create new OR show existing via POST method on the collection. I'm trying to accomplish this via hook filters but I don't know how to abort the creation of the data.

Any idea on how I could accomplish this? Any better approach?

Thanks in advance.

question

Most helpful comment

I'll close this as it's not a bug... but maybe @bjgajjar has some thoughts around how to cancel an item creation from within a hook?

All 4 comments

I tried using item.read and response hooks but failed.
For _item.read_, I can't get the value of the payload via $payload->getData() I'm getting a ZendDB object instead. For
_response_, I can get the value but I need to be able to get the filter parameter passed to GET method which I don't know how. They might be a function for this but I haven't found it yet.

Any input is appreciated. Thanks.

_As this isn't quite an "issue", with Directus GitHub isn't really the best place to be asking, the best places to ask questions about Directus, is to either tag Directus on StackOverflow or join the Directus Slack (https://directus.chat)._

In response, I'm not quite sure what you're asking, are you making an extension?
I would imagine to abort creation, just don't submit the data for creation...

:thinking:

I'll close this as it's not a bug... but maybe @bjgajjar has some thoughts around how to cancel an item creation from within a hook?

Hey @AstralProgrammer

I am not sure what exactly the issue is; but payload will fetch from $payload->getData() only. You can ping me in our slack channel to discuss the stuff briefly. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cdwmhcc picture cdwmhcc  路  3Comments

benhaynes picture benhaynes  路  4Comments

vuhrmeister picture vuhrmeister  路  3Comments

maettyhawk picture maettyhawk  路  3Comments

magikstm picture magikstm  路  3Comments