I am trying to implement custom mapping for a database I am using that was pre-setup with primary key fields like tablename_id
instead of just id
.
I gleaned this from the 2.0 manual:
class MyBeanFormatter implements RedBean_IBeanFormatter {
public function formatBeanID($type) {
return $type.'_id';
}
}
R::$writer->setBeanFormatter( new MyBeanFormatter );
In 3.0, there is no interface RedBean_IBeanFormatter
and no function formatBeanID
. The 3.0 manual, doesn't provide a lot to go on for this. Any help would
Custom mapping is no longer supported in 3.0. RedBeanPHP 3 and higher require tables to map 1-to-1 to bean types. This is part of the design philosophy of RedBeanPHP. It might be less useful for existing projects but I believe it keeps database mapping more maintainable in the end. This decision also allows RB to provide lots of power features, like deep-copy and exportAll while being relatively light-weight and fast.