Controller/CssController.php
public function onCssLastModified(ContentEvent $event)
    {
        // @TODO lastmodified files from themeBundle templates
        $reflection = new \ReflectionClass(get_class($this));
        // @TODO
        if(strpos($reflection->getFileName(), '/cache/')) {
            $dir = dirname($reflection->getFileName()) . '/../../..';
        } else {
            $dir = dirname($reflection->getFileName()) . '/../../../../../..';
        }

        if(get_class($this) != "eDemy\MainBundle\Controller\MainController") {
        }


        $finder = new Finder();
        // @TODO
        $finder
            ->files()
            ->in($dir . '/vendor/edemy/mainbundle/eDemy/*/Resources/views/assets')
            ->name('*.css.twig')
            ->sortByModifiedTime();

        foreach ($finder as $file) {
            //$lastmodified = new \DateTime();
            $lastmodified = \DateTime::createFromFormat( 'U', $file->getMTime() );
            //$formattedString = $currentTime->format( 'c' );
            if($event->getLastModified() > $lastmodified) {
                //$event->setLastModified($lastmodified);
            } else {
                $event->setLastModified($lastmodified);
            }
        }
    }
public function onCssLastModified(ContentEvent $event)
    {
        // @TODO lastmodified files from themeBundle templates
        $reflection = new \ReflectionClass(get_class($this));
        // @TODO
        if(strpos($reflection->getFileName(), '/cache/')) {
            $dir = dirname($reflection->getFileName()) . '/../../..';
        } else {
            $dir = dirname($reflection->getFileName()) . '/../../../../../..';
        }

        if(get_class($this) != "eDemy\MainBundle\Controller\MainController") {
        }


        $finder = new Finder();
        // @TODO
        $finder
            ->files()
            ->in($dir . '/vendor/edemy/mainbundle/eDemy/*/Resources/views/assets')
            ->name('*.css.twig')
            ->sortByModifiedTime();

        foreach ($finder as $file) {
            //$lastmodified = new \DateTime();
            $lastmodified = \DateTime::createFromFormat( 'U', $file->getMTime() );
            //$formattedString = $currentTime->format( 'c' );
            if($event->getLastModified() > $lastmodified) {
                //$event->setLastModified($lastmodified);
            } else {
                $event->setLastModified($lastmodified);
            }
        }
    }
public function onCssLastModified ( ContentEvent $ event ) { // @TODO lastmodified files from themeBundle templates $ reflection = new \ ReflectionClass ( get_class ( $ this ) ) ; // @TODO if ( strpos ( $ reflection -> getFileName ( ) , '/cache/' ) ) { $ dir = dirname ( $ reflection -> getFileName ( ) ) . '/../../..' ; } else { $ dir = dirname ( $ reflection -> getFileName ( ) ) . '/../../../../../..' ; } if ( get_class ( $ this ) != "eDemy\MainBundle\Controller\MainController" ) { } $ finder = new Finder ( ) ; // @TODO $ finder -> files ( ) -> in ( $ dir . '/vendor/edemy/mainbundle/eDemy/*/Resources/views/assets' ) -> name ( '*.css.twig' ) -> sortByModifiedTime ( ) ; foreach ( $ finder as $ file ) { //$lastmodified = new \DateTime(); $ lastmodified = \ DateTime :: createFromFormat ( 'U' , $ file -> getMTime ( ) ) ; //$formattedString = $currentTime->format( 'c' ); if ( $ event -> getLastModified ( ) > $ lastmodified ) { //$event->setLastModified($lastmodified); } else { $ event -> setLastModified ( $ lastmodified ) ; } } }
Este listener calcula lastmodified de la ruta

@param ContentEvent $event
@return bool
Este listener calcula lastmodified de la ruta