Hi Guys,
I would love your thoughts about these 2 helper methods. They make the code a little shorter and cleaner, but do you think they make sense? Are they worth it?
class Page{
public static function get_one( $class = false, $filter = null, $cache = true, $orderby = null ){
return DataObject::get_one( ( $class ) ? $class : get_called_class(), $filter, $cache, $orderby );
}
public static function get_by_id( $id, $class = false, $cache = true ){
return DataObject::get_by_id( ( $class ) ? $class : get_called_class(), $id, $cache );
}
...
}
To call them I use:
MyPage::get_by_id( 5 );
MyPage::get_one();
Rather then:
DataObject::get_by_id( 'MyPage' , 5 );
// OR
MyPage::get_by_id( 'MyPage', 5 );