MigrationBundle/Migrations/Version20170307181737.php
protected function createFolderPath()
    {
        $this->write('  + Adding folderPath');

        $rootFolders = $this->container->get('open_orchestra_media.repository.media_folder')->findBy(array('parent' => null));
        foreach ($rootFolders as $folder) {
            $oldPath = $folder->getPath();
            $folder->setPath('/');
            $event = $this->container->get('open_orchestra_media_admin.event.folder_event.factory')->createFolderEvent();
            $event->setFolder($folder);
            $event->setPreviousPath($oldPath);
            $this->container->get('event_dispatcher')->dispatch(FolderEvents::PATH_UPDATED, $event);
        }

        $this->container->get('object_manager')->flush();
    }
protected function createFolderPath()
    {
        $this->write('  + Adding folderPath');

        $rootFolders = $this->container->get('open_orchestra_media.repository.media_folder')->findBy(array('parent' => null));
        foreach ($rootFolders as $folder) {
            $oldPath = $folder->getPath();
            $folder->setPath('/');
            $event = $this->container->get('open_orchestra_media_admin.event.folder_event.factory')->createFolderEvent();
            $event->setFolder($folder);
            $event->setPreviousPath($oldPath);
            $this->container->get('event_dispatcher')->dispatch(FolderEvents::PATH_UPDATED, $event);
        }

        $this->container->get('object_manager')->flush();
    }
protected function createFolderPath ( ) { $ this -> write ( '  + Adding folderPath' ) ; $ rootFolders = $ this -> container -> get ( 'open_orchestra_media.repository.media_folder' ) -> findBy ( array ( 'parent' => null ) ) ; foreach ( $ rootFolders as $ folder ) { $ oldPath = $ folder -> getPath ( ) ; $ folder -> setPath ( '/' ) ; $ event = $ this -> container -> get ( 'open_orchestra_media_admin.event.folder_event.factory' ) -> createFolderEvent ( ) ; $ event -> setFolder ( $ folder ) ; $ event -> setPreviousPath ( $ oldPath ) ; $ this -> container -> get ( 'event_dispatcher' ) -> dispatch ( FolderEvents :: PATH_UPDATED , $ event ) ; } $ this -> container -> get ( 'object_manager' ) -> flush ( ) ; }
Add Path to each folder
Add Path to each folder