Jump to content

LeoFelipe

New Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by LeoFelipe

  1. I'm beginning to study Composer and am developing a system where I separate the files core application files, as follows:



    /root
    |-- /src
    |-- /App
    |-- /DBConfig
    |-- /Controller
    |-- /Model
    |-- /Core
    |-- /Helper
    |-- /Controller
    |-- /Model

    So, to set this setting in composer.json file and get access to all classes both /App much /Core would be this way?



    "autoload" : {
    "psr-X" : {
    "App\\" : "/src",
    "Core\\" : "/src"
    }
    }

    Or is there a more correct way?


    I have also read about PSR-0 vs PSR-4 and I am still somewhat in doubt which one to use. In my case what should I implement, PSR-0 or PSR-4?


  2. That is really hard, your mind may be blown.

     

    $dirs = array(__DIR__ . "/src", __DIR__ . "/src2");
    $config = Setup::createAnnotationMetadataConfiguration($dirs, $isDevMode);
    
    To make it easier to consume:

     

    $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__ . "/src", __DIR__ . "/src2"), $isDevMode);
    Now for the complete meltdown:

     

    $config = Setup::createConfiguration();
    
    $chain = new MetadataChain();
    
    foreach (array('xml' => __DIR__ . "/src", 'yml' => __DIR__ . "/src2") as $driverName => $path) {
      switch ($driverName) {
        case 'xml': $driver = new SimplifiedXmlMetadataDriver($path);
        case 'yml': $driver = new SimplifiedYamlMetadataDriver($path);
      }
      $chain->addDriver($driver);
    }
    
    $config->setMetadataDriver($chain);
    ..
    EDIT: do not copy paste, it won't work, you'll need to do your own research.

     

     

    Hey man. Thanks again for your help. I tested the code and it worked.

  3. That is really hard, your mind may be blown.

     

    $dirs = array(__DIR__ . "/src", __DIR__ . "/src2");
    $config = Setup::createAnnotationMetadataConfiguration($dirs, $isDevMode);
    
    To make it easier to consume:

     

    $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__ . "/src", __DIR__ . "/src2"), $isDevMode);

     

    º_º ... Is that so hard? kkkk

     

    I should have known. I'm ashamed of myself! Upon arriving home I will test and give feedback.

     

    Thank you very much.

  4. I'm starting in Doctrine 2.4 and I'm developing a system where I separate the core files and application files, as follows:

    /root
      |-- /Src
            |-- /App
                  |-- /Model
                        |-- ** (Application Entities) **
            |-- /Core
                  |-- /Model
                        |-- ** (Core Entities) **

    In the Doctrine documentation shows the following form to set 1 directory for Esntitys:

    $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__. "/src"), $isDevMode);

    But when I have to configure more than one directory that will contain the Entitys of my application, how to proceed?

     

    Thanks in advance!

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.