UnionOfRAD/lithium — pull request #885 by jails (2013-04-15 00:59:39+00:00)
Title: RFC: HABTM support

Hi guys, I started the lithium adventure one year ago. Li3 is an awesome framework which I began to be pretty comfortable with. I really want the upcoming 1.0 brings an army of new fans and contributors to make this framework even more popular.

### Why I'm talking about HABTM relations ?

HABTM is considered as a bad abstraction and I'm pretty agree. It's not the best abstraction ever made. However it's an abstraction which it used by numbers of coder as a plinth to higher abstraction (e.g to allow nested saving directly from form submitted datas).

Each time I needed an HABTM associations in projects, it always resulted into a dillution of some copy/paste of extra (read crappy here) code.

Each time I tried to convince friends to start using Li3, they always turned back when I failed to provide a solid alternative for HABTM relation.

### What am I aiming at ?

I'm not afraid to to justify a position even alone against the world, but for the HABTM:
- Li3 does not offer a solid alternative.
- Coder don't like changing their shopping patterns.
- The whole world is against us.

### Conclusion

To conclude, I wanted to show how difficult is it for a newcomer to reach the abstraction provided by a lot of framework like the simple `saveAll` a la CakePHP).

Almost all this PR for allowing the following syntax:
```php
$image = Images::create(array(
'image' => 'someimage.png',
'title' => 'Image1 Title',
'tags' => array(1, 3, 6) // <- This format is compatible with a submited form select
));
$image->save(null, array('with' => 'Tags')); // The image is saved with its associated tags
```

Wanted to know your point of view on this subject and what alternative we can bring to make this kind of abstraction easier to reach for newcomer.