Feature #8953
Tx_Formhandler_Finisher_DB data dumped to $this->gp
| Status: | Closed | Start date: | 2010-07-20 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assignee: | Mathias Bolt Lesniak | % Done: | 100% |
|
| Category: | Finisher | |||
| Target version: | Beta 5 (v0.9.8) | |||
| Votes: | 0 |
Description
Hi!
The attached diff patches Tx_Formhandler_Finisher_DB to dump the data written to DB to $this->gp. This is useful in the cases where a preProcess or postProcess changes the data written to DB (e.g. adding randomized data or MD5 hashing it), and you want to present it to the user (let's say in an e-mail).
Example:
Your form generates fe_users, and the username is automatically generated. The generated username can be displayed with the marker
###value_saveDB|0|data|username###.
If you have multiple DB finishers the@ might change into another number. It's the sequential number of your DB Finisher. @usernameis the fieldname.
- Mathias
History
Updated by Thomas Deinhamer almost 3 years ago
Hah, I just needed this myself and I'm so glad you just posted this 4 hours ago. Yeah!
Maybe the behaviour of this function/feature should be configurable inside the finisher configuration.
Updated by Mathias Bolt Lesniak almost 3 years ago
Thomas Deinhamer wrote:
Hah, I just needed this myself and I'm so glad you just posted this 4 hours ago. Yeah!
Glad to be of service. B-)
Maybe the behaviour of this function/feature should be configurable inside the finisher configuration.
If you have any specific configurations in mind, I'd be delighted if you posted them here.
- Mathias
Updated by Reinhard Führicht almost 3 years ago
+1 by reading.
Fabien, you patched this finisher recently. What do you think?
I'm currently not able to test anything because I'm on vacation till July 30.
Updated by Fabien Udriot almost 3 years ago
Conceptually speaking, this is a bit weird to put "saveDB" into "GP". Shouldn't this information be stored in some kind of global property to formhandler that would be piped from one component to an other. At least, this how GP is used at the moment. The same remark would apply to "inserted_uid". Unfortunately, my spare time is not as much extensible to take care of that.
Regarding the marker, I see some "danger" here, as the order of the finisher may change later on. Thus, you would need to change the index of the marker, if I am right. Isn't it something easily forgettable?
###value_saveDB|0|data|username###.
What about that syntax:
###value_saveDB|tablename|field### example: ###value_saveDB|fe_users|username###
In same rare case, it may happen there is mulitple fe_users to be saved. So we could identify that case and add a suffix: ###value_saveDB|fe_users_2|username###.
I don't know... It is just an idea.
Updated by Mathias Bolt Lesniak almost 3 years ago
Fabien Udriot wrote:
Conceptually speaking, this is a bit weird to put "saveDB" into "GP". Shouldn't this information be stored in some kind of global property to formhandler that would be piped from one component to an other. At least, this how GP is used at the moment. The same remark would apply to "inserted_uid". (...)
I agree with your notion of what's conceptually right here, though I also agree it's a little much to take on. Moving "inserted_uid" would also break existing setups, of course.
Maybe the best thing would be to wait with moving the properties until Fluid templates are implemented. They're anyway more flexible.
Regarding the marker, I see some "danger" here, as the order of the finisher may change later on. Thus, you would need to change the index of the marker, if I am right. Isn't it something easily forgettable? [...]
What about that syntax: [...]
In same rare case, it may happen there is mulitple fe_users to be saved. So we could identify that case and add a suffix: ###value_saveDB|fe_users_2|username###.
That sounds like a good idea to me. I'll implement that if you'd like.
- Mathias
Updated by Fabien Udriot almost 3 years ago
That sounds like a good idea to me. I'll implement that if you'd like.
Yeah would be cool! I will be testing
Updated by Mathias Bolt Lesniak almost 3 years ago
- File Tx_Formhandler_Finisher_DB.php.patch added
Hi!
I have attached a new patch with the setup suggested by Fabien. If it looks OK, I'll commit it. :-)
- Mathias
Updated by Mathias Bolt Lesniak almost 3 years ago
- Status changed from New to Closed
Got impatient, so I committed this change (36838) - after testing, of course. Closing this issue now. :-)