Feature #4137
Save form data to more than one table
| Status: | Closed | Start date: | 2009-08-04 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assignee: | Reinhard Führicht | % Done: | 100% |
|
| Category: | Finisher | |||
| Target version: | - | |||
| Votes: | 0 |
Description
It should be possible to split the data to different tables using foreign keys.
Example:
Using formhandler to create an FE user. Data should be inserted to fe_users and maybe tt_address.
Currently I don't have a solution, just the idea. So feel free to share some ideas.
History
Updated by Reinhard Führicht almost 4 years ago
- Status changed from New to Needs Feedback
I came up with the following idea:
As you can chain the finishers, you could add 2 or more Finisher_DB to store the data to different tables.
The inserted uids and table names should be passed in $this->db.
And there must be a way to access this information via TypoScript.
Example:
finishers {
1.class = Finisher_DB
1.config {
table = tx_myext_mytable
fields {
...
}
}
2.class = Finisher_DB
2.config {
table = tx_myext_mychildtable
fields {
pid = ###tx_myext_mytable::uid###
}
}
}
The marker ###tx_myext_mytable::uid### will be replaced by the uid of the inserted record.
What do you think about this solution?
Updated by Reinhard Führicht almost 4 years ago
- Status changed from Needs Feedback to Closed
- % Done changed from 0 to 100
Committed in Revision r23243.
New TS option:
special = inserted_uid
special.table = ...
Example:
finishers {
1.class = Finisher_DB
1.config {
table = fe_users
fields {
username.mapping = lastname
}
}
2.class = Finisher_DB
2.config {
table = tt_address
fields {
pid.special = inserted_uid
pid.special.table = fe_users
email.mapping = email
first_name.mapping = firstname
last_name.mapping = lastname
}
}
}