Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

File Bundle Laravel Package

bengor-file/file-bundle

View on GitHub
Deep Wiki
Context7

Doctrine ODM MongoDB

CAUTION! The actual release of DoctrineMongoDBBundle is not compatible with PHP7

The basic configuration chapter is made with Doctrine ORM persistence layer. Apart of that, this bundle also supports MongoDB's Doctrine ODM. The bundle documentation is very complete and self-explanatory but anyway, this section shows basic configuration to make work properly.

Firstly, install the bundle with Composer

$ composer require bengor-file/doctrine-odm-mongodb-bridge-bundle

Next, register the annotations library by adding the following to the autoloader (below the existing AnnotationRegistry::registerLoader line) in the app/autoload.php file

use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;

AnnotationDriver::registerAnnotationClasses();

Once the bundle has been installed enable it in the AppKernel:

// app/config/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle(),
        // ...
        new BenGorFile\DoctrineODMMongoDBBridgeBundle\BenGorFileDoctrineODMMongoDBBridgeBundle(),  
        
        // In case we are using SimpleBus as Bus adapter
        new BenGorFile\SimpleBusBridgeBundle\BenGorFileSimpleBusBridgeBundle(),
        new BenGorFile\SimpleBusBridgeBundle\BenGorFileSimpleBusDoctrineODMMongoDBBridgeBundle(),
        
        new BenGorFile\FileBundle\BenGorFileBundle(),
        // ...
    ];
}

Instead of ORM that needs inside src/AppBundle/Entity directory, the MongoDB's Doctrine ODM needs the models be inside src/AppBundle/Document folder.

// src/AppBundle/Document/File.php

namespace AppBundle\Document;

use BenGorFile\File\Domain\Model\File as BaseFile;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;

/**
 * [@MongoDB](https://github.com/MongoDB)\Document
 */
class File extends BaseFile
{
}

To get started, you'll need some basic configuration that sets up the document manager. The easiest way is to enable auto_mapping, which will activate the MongoDB ODM across your application:

# app/config/config.yml

doctrine_mongodb:
    connections:
        default:
            server: mongodb://localhost:27017
            options: {}
    default_database: bengor_file_db
    document_managers:
        default:
            auto_mapping: true

ben_gor_file:
    file_class:
        file:
            class: AppBundle\Document\File
            persistence: doctrine_odm_mongodb
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui