Aimeos\ShopBundle\Composer\ScriptHandler::updateRoutingFile PHP Method

updateRoutingFile() protected static method

Adds the Aimeos shop bundle to the routing file of the application.
protected static updateRoutingFile ( string $filename )
$filename string Name of the YAML config file
    protected static function updateRoutingFile($filename)
    {
        $update = false;
        if (($content = file_get_contents($filename)) === false) {
            throw new \RuntimeException(sprintf('File "%1$s" not found', $filename));
        }
        if (strpos($content, 'aimeos_shop:') === false) {
            $content .= "\n" . 'aimeos_shop:
    resource: "@AimeosShopBundle/Resources/config/routing.yml"
    prefix: /';
            $update = true;
        }
        if (strpos($content, 'aimeos_shop_adm:') === false) {
            $content .= "\n" . 'aimeos_shop_adm:
    resource: "@AimeosShopBundle/Resources/config/routing_adm.yml"
    prefix: /';
            $update = true;
        }
        if ($update === true) {
            $fs = new Filesystem();
            $fs->dumpFile($filename, $content);
        }
    }