Fixed the computation of the max position for new association groups

The call to persist for the related grouping association may be done after
persisting the sortable item.
Fixes #883
Fixed the check for the state of entities

- the state can only be checked for mapped classes, not for any object
  (DateTime objects in a field are transient)
- entities scheduled for insertion are in the managed state without having
  an identifier so both checks are needed.
Merge pull request #887 from stof/sortable_association

Fixed the computation of the max position for new association groups
Add testing on PHP 5.5 on Travis