You could use a SplPriorityQueue for this purpose (see https://github.com/KnpLabs/KnpRadBundle/blob/9f3b54f30b042504977e9643ff91837584670e76/Form/FormManager.php#L14)