private function addService($path, $bundleName, $name, $formTypeName)
    {
        $ref = '<services>';
        $replaceBefore = true;
        $group = $bundleName . '_' . $name;

        $declaration = <<<EOF
        <service id="$bundleName.form.type.$name" class="%$bundleName.form.type.$name.class%">
            <argument>%$bundleName.model.$name.class%</argument>
            <argument type="collection">
                <argument>$group</argument>
            </argument>
            <tag name="form.type" alias="$formTypeName" />
        </service>
EOF;

        if ($this->refExist($path, $declaration)) {
            return;
        }

        if (!$this->refExist($path, $ref)) {
            $ref = '</container>';
            $replaceBefore = false;
            $declaration = <<<EOF
    <services>
$declaration
    </services>
EOF;
        }

        $this->dumpFile($path, "\n" . $declaration . "\n", $ref, $replaceBefore);
    }