Something like that. The only issue is that we require scope: prototype, (a new instance to be returned every time get() is called). With that, it would return the same instance every time get is called.

I've tried to figure out the container before and all the special magic with scope: prototype, but I was unable to figure out how it handles everything (you cannot just call set and then apply the prototype scope).

I'm not 100% sure this will work correctly, but I would try:
```
$db = $this->db;
$this->container->set('phpbb.boardrules.entity', function() use ($db) {
    return new \ext\phpbb\boardrules\entity\rule($db, 'phpbb_boardrules');
});
```

You could test to see if it works by trying this then:
```
$entity1 = $this->container->get('phpbb.boardrules.entity');
$entity1->set_title('foobar');
$entity2 = $this->container->get('phpbb.boardrules.entity');
if ($entity2->get_title() === '')
{
    // worked!
}
```