DependencyInjection/BaseContainerAccessor.php
protected function save($entities)
    {
        if (!is_array($entities)) {
            $entities = [$entities];
        }

        foreach ($entities as $entity) {
            $entityClass = get_class($entity);
            $entityManager = $this
                ->get('base.object_manager_provider')
                ->getObjectManagerByEntityNamespace($entityClass);
            $entityManager->persist($entity);
            $entityManager->flush($entity);
        }
    }
protected function save($entities)
    {
        if (!is_array($entities)) {
            $entities = [$entities];
        }

        foreach ($entities as $entity) {
            $entityClass = get_class($entity);
            $entityManager = $this
                ->get('base.object_manager_provider')
                ->getObjectManagerByEntityNamespace($entityClass);
            $entityManager->persist($entity);
            $entityManager->flush($entity);
        }
    }
protected function save ( $ entities ) { if ( ! is_array ( $ entities ) ) { $ entities = [ $ entities ] ; } foreach ( $ entities as $ entity ) { $ entityClass = get_class ( $ entity ) ; $ entityManager = $ this -> get ( 'base.object_manager_provider' ) -> getObjectManagerByEntityNamespace ( $ entityClass ) ; $ entityManager -> persist ( $ entity ) ; $ entityManager -> flush ( $ entity ) ; } }
Save entity or array of entities.

@param mixed $entities
Save entity or array of entities .