Generator/Generator.php
public function needToOverwrite(AdminGenerator $generator)
    {
        if ($this->container->getParameter('admingenerator.overwrite_if_exists')) {
            return true;
        }

        $cacheDir = $this->getCachePath($generator->getFromYaml('params.namespace_prefix'), $generator->getFromYaml('params.bundle_name'));

        if (!is_dir($cacheDir)) {
            return true;
        }

        $fileInfo = new \SplFileInfo($this->getGeneratorYml());

        $finder = new Finder();
        $files = $finder->files()
                        ->date('< '.date('Y-m-d H:i:s',$fileInfo->getMTime()))
                        ->in($cacheDir)
                        ->count();

        if ($files > 0) {
            return true;
        }

        $finder = new Finder();
        foreach ($finder->files()->in($cacheDir) as $file) {
            if (false !== strpos(file_get_contents($file), 'AdmingeneratorEmptyBuilderClass')) {
                return true;
            }
        }

        return false;
    }
public function needToOverwrite(AdminGenerator $generator)
    {
        if ($this->container->getParameter('admingenerator.overwrite_if_exists')) {
            return true;
        }

        $cacheDir = $this->getCachePath($generator->getFromYaml('params.namespace_prefix'), $generator->getFromYaml('params.bundle_name'));

        if (!is_dir($cacheDir)) {
            return true;
        }

        $fileInfo = new \SplFileInfo($this->getGeneratorYml());

        $finder = new Finder();
        $files = $finder->files()
                        ->date('< '.date('Y-m-d H:i:s',$fileInfo->getMTime()))
                        ->in($cacheDir)
                        ->count();

        if ($files > 0) {
            return true;
        }

        $finder = new Finder();
        foreach ($finder->files()->in($cacheDir) as $file) {
            if (false !== strpos(file_get_contents($file), 'AdmingeneratorEmptyBuilderClass')) {
                return true;
            }
        }

        return false;
    }
public function needToOverwrite ( AdminGenerator $ generator ) { if ( $ this -> container -> getParameter ( 'admingenerator.overwrite_if_exists' ) ) { return true ; } $ cacheDir = $ this -> getCachePath ( $ generator -> getFromYaml ( 'params.namespace_prefix' ) , $ generator -> getFromYaml ( 'params.bundle_name' ) ) ; if ( ! is_dir ( $ cacheDir ) ) { return true ; } $ fileInfo = new \ SplFileInfo ( $ this -> getGeneratorYml ( ) ) ; $ finder = new Finder ( ) ; $ files = $ finder -> files ( ) -> date ( '< ' . date ( 'Y-m-d H:i:s' , $ fileInfo -> getMTime ( ) ) ) -> in ( $ cacheDir ) -> count ( ) ; if ( $ files > 0 ) { return true ; } $ finder = new Finder ( ) ; foreach ( $ finder -> files ( ) -> in ( $ cacheDir ) as $ file ) { if ( false !== strpos ( file_get_contents ( $ file ) , 'AdmingeneratorEmptyBuilderClass' ) ) { return true ; } } return false ; }
Check if we have to build file
Check if we have to build file