[TYPO3-irre] IRRE + dbal without pid :)
Nikolas Hagelstein
hagelstein at shr.cc
Thu May 3 10:27:41 CEST 2007
Oliver Hader wrote:
> I'm wondering if it is possible to create new records for the table
> without the pid field e.g. via list module.
To clearify things i "predented" a pid by setting the DBAL mapping to :
'tx_myext_cost_centres' => array (
'mapTableName' => 'KOSTST',
'mapFieldNames' => array (
'uid' => 'KST_ID',
'pid' => 76,
'navtitle' => 'KST_NAME',
'title' => 'KST_NAME',
'code' => 'KST_CODE',
'parent' => 'KST_PARENT'
)
),
This makes the cost centre records appear on PID 76 (virtually)
>TCEmain tries to check
> access to the page by pid - currently I don't know how this will work
> without a proper pid.
Yes right that causses the "access denied atm" because in fact the
records show up at
Pid 76 since they are fetched by something like:
"select * from table where pid=76"
Which gets rewritten by DBAL To "select * from table where 76=76" but
obviously the record itself doesnt own a pid field itself. :)
Therefore i thought of hooking in at :
- processDatamap_preProcessFieldArray and fake pid
- processDatamap_PostProcessFieldArray unset the fake pid (otherwise a
DB error would occure)
> The identifiert "data[...][<table>][<uid>][<field>]..." is split for
> AJAX calls. Currently IRRE expects to have something set as pid and
> fails if this is empty. I think this could be fixed with no bigger
> efforts.
Yes right if the pid is set to '' the parsing rexep fails and the whole
parsing gets screwed up. :)
> $this->inlineFirstPid is set to the pid of the first parent record
> (the one you select in the list module to edit).
Right but as mentioned before this one doesnt ows a pid, therefor it
should be fixed implementing the hook idea
mentioned above right?
> Thus you would set the pid to a fixed value - but if the involved
> records (parent, children, etc.) don't have pids at all, how should
> the system automatically determine this value?
The related records own pids since they are "real typo3 tables" ...
> You can send me your extension via PM. Maybe it would also possible
> to change the DBAL to use MySQL only,
It would be pretty hard to extract the relevant parts.
All you have to do is to create a table in mysql in a db different to
typo3.
Configure DBAL as follows:
$TYPO3_CONF_VARS['EXTCONF']['dbal']['handlerCfg'] = array (
'_DEFAULT' => array (
'type' => 'native',
'config' => array (
'username' => '', // Set by default (overridden)
'password' => '', // Set by default (overridden)
'host' => '', // Set by default (overridden)
'database' => ''
)
),
'testDB' => array (
'type' => 'adodb',
'config' => array(
'username' => 'whatever',
'password' => 'whatever',
'host' => 'localhost',
'database' => 'testDB',
'driver' => 'mysql',
)
),
);
$TYPO3_CONF_VARS['EXTCONF']['dbal']['table2handlerKeys'] = array (
'testTbl' => 'testDB',
);
$TYPO3_CONF_VARS['EXTCONF']['dbal']['mapping'] = array (
'testTbl' => array (
'mapFieldNames' => array (
'uid' => 'id',
'pid' => 76,
)
),
Afterwards create some dummy records in testTbl. They shoud appear at
pid 76 in listmode.
Change TCA of testTBL to some IRRE relational stuff e.g. assign pages or
fe_users to it ....
Well that is basically what i am doing atm.
BEWARE: there is a ugly bug in DBAL which makes record saving fail if
DBAL Debug is turned on (even on the _DEFAULT handler) so make sure you
turn it of :)
> because I don't have PostgreSQL
Even more worse it is MSSQL in this case :)
Cheers,
Nikolas
More information about the TYPO3-project-irre
mailing list