$formatter->formatBeanID( "session" )
You can then say in your formatter:
function formatBeanID( $table ) {
if ($table=="session") return $myDifferentID;
}
RedBean always needs a primary key, you can rename the key but it is
impossible (not entirely of course) by design to have tables with no
primary key at all. I would recommend to simply use a bean formatter
or rename the field in your DB. If this is the only table in your DB
with this problem you may also opt to write custom queries for that
one.
There is of course the possibility to make a plugin to overrule the
behavior of RB but I think it's not worth the trouble.
Does this help?
Cheers,
Gabor
> --
> You received this message because you are subscribed to the Google Groups "redbeanphp" group.
> To post to this group, send email to redbe...@googlegroups.com.
> To unsubscribe from this group, send email to redbeanorm+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/redbeanorm?hl=en.
>
>
Verstuurd vanaf mijn iPhone
You can format the id of bean but Redbean always requires an
auto-incremented id. The only way to accomplish what you want is:
$sessionObject = R::dispense("sessions");
$sessionObject->session_id = 'gos81vu0ss9tl8tui959knrdo5';
$sessionObject->expire = (time() + 3600);
$sessionObject->session_data = serialize( array('bla','bla','bla') );
$id = R::store( $sessionObject );
But you will always get the 'extra' auto-incremented ID. There is no
way around that.
It may sound inflexible but I have to make choices.
Cheers
Gabor