Giter Site home page Giter Site logo

laravel-doctrine / orm Goto Github PK

View Code? Open in Web Editor NEW
817.0 817.0 178.0 1.01 MB

A drop-in Doctrine ORM 2 implementation for Laravel 5+ and Lumen

Home Page: http://laraveldoctrine.org

License: MIT License

PHP 100.00%
doctrine doctrine-extension doctrine-orm hacktoberfest laravel laravel-5-package laravel-package orm

orm's People

Contributors

amrit01 avatar barryo avatar bjdelange avatar blacktemplar avatar dpslwk avatar eigan avatar foxxmd avatar garret-gunter avatar gmsantos avatar guiwoda avatar jakub-klapka avatar jalle19 avatar jrgilman avatar jurigag avatar keithbrink avatar korri avatar maxbrokman avatar mbbender avatar patrickbrouwers avatar r3volut1oner avatar sergiy-petrov avatar sisve avatar sojeda avatar soltmar avatar sserbin avatar stephandesouza avatar sztyup avatar vladyslavstartsev avatar xaben avatar zackrowe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

orm's Issues

QueryBuilder getSingleResult() and getOneOrNullResult() are returning Collections instead of the Class

$manga = EntityManager::createQueryBuilder()
        ->select("st1")
        ->from("{$roninManga}SeriesType","st1")
        ->where("LOWER(st1.url) = :url")
        ->setParameter("url","manga")
        ->getQuery()->getSingleResult();
        $manhwa = EntityManager::createQueryBuilder()
                               ->select("st2")
                               ->from("{$roninManga}SeriesType","st2")
                               ->where("LOWER(st2.url) = :url")
                               ->setParameter("url","manhwa")
                               ->getQuery()
            ->getOneOrNullResult();

Both return collection instead of the class, this code worked before.

[1.*] Add mongodb support

Per maxmatteo we should investigate the feasibility of adding support for mongodb. Doctrine already has an ODM so it may be a simple process to tie it into Laravel Doctrine..

getProxyDefinition(): Failed opening required '/tmp/__CG__AppTeam.php'

Error:
Doctrine\Common\Proxy\AbstractProxyFactory::getProxyDefinition(): Failed opening required '/tmp/__CG__AppTeam.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/local/bin')

It sounded like a permissions problem (but on /tmp?), and this StackOverflow slightly agrees. I even generated the proxies manually as the SO suggests, but I still get this error.

Even worse, my app properly generated into /home/../storage/proxies, but this page says it's looking into /tmp.

I did clear my cache with artisan and composer and have no outstanding composer updates.

I'm not sure if all the changes in the 1.0.0 may fix this problem. I don't have an easy way to test that.

Doctrine Paginator foreach not working

After the latest changes the following example code stopped working:

<?php namespace App\Http\Controllers;

use Illuminate\Routing\Controller as BaseController;
use Doctrine\ORM\Tools\Pagination\Paginator;
use Doctrine\ORM\EntityManager;
use App\Repositories\Entities\Product;

class TestController extends BaseController
{

    private $product;

    public function __construct(EntityManager $em, Product $product)
    {
        $this->product = $product;
        $this->em = $em;
    }

    public function index()
    {
        $dql = "SELECT p FROM App\\Repositories\\Entities\\Product p ";
        $query = $this->em->createQuery($dql)
                          ->setFirstResult(0)
                          ->setMaxResults(100);
        $paginator = new Paginator($query, $fetchJoinCollection = true);
        $c = count($paginator);

        foreach( $paginator as $post )
        {
            dd($post, 2);
        }
    }

}

DQL getSingleResult and getOneOrNullResult are not working correctly

Hello,

today I learned that DQL getSingleResult or getOneOrNullResult functions do not work as expected. Example source code:

$package = EM::createQuery("SELECT p FROM Entity\Package p WHERE p.minCourses <= :courses AND (p.maxCourses >= :courses OR p.maxCourses IS NULL)")
             ->setParameter('courses', $courseCount)
             ->setMaxResults(1)
             ->getSingleResult();

Instead of getting a single Entity, I am receiving result wrapped in Illuminate/Support/Collection. I was digging deeper in the source code and it looks like the following source code fails in Doctrine\ORM\AbstractQuery

if ( ! is_array($result)) {    // <-- $result here is Illuminate/Support/Collection object
     return $result;
}

Would it be possible to have an option in the config file to use array instead of Illuminate/Support/Collection for the result set?

Looking forward!

Best regards,
Linas Pašviestis

Password reset broken

I'm getting this error

ErrorException in DoctrineTokenRepository.php line 132:
Argument 1 passed to LaravelDoctrine\ORM\Auth\Passwords\DoctrineTokenRepository::reminderExpired() must be an instance of LaravelDoctrine\ORM\Auth\Passwords\PasswordReminder

This is apparently because getOneOrNullResult() returns Illuminate\Support\Collection instead of the expected single entity.

Write configuration array to php file without evaluating expressions

In order to generate a configuration file for a user we want to be able to leave expressions in place in the configuration array.

Say we have this array schema for a manager in the new configuration

return [
    ...
    'connection' => $isFork ? $sourceArray['connection'] : config('database.default'),
    ...
];

When this array is eventually written out to a php file (right now using var_export and file_put_contents) we will see

'connection' => config('database.default')

become

'connection' => 'default_connection',

because the expression is evaluated. What we need is a way to prevent expressions as values in the array from being evaluated but also ensuring

'connection' => $isFork ? $sourceArray['connection']

does evaluate to

'connection' => 'my_connection'

[1.1] Integration testing tools

Laravel has some useful testing tools like seeInDatabase but this runs on the Laravel connection. Perhaps we could provide Doctrine implementation for this.

No EntityManager is set-up for

Hi. In "config/auth" I have this:

'driver' => 'doctrine',
'model' => Domain\Usuarios\Entities\User::class,


In "Domain\Usuarios\Entities\User.php" I have this:

Problems installing with composer

I trying yo install this package to test it, but when doing composer require and with minimum-stability set to dev it still says "a typo or the package is not available in a stable-enough version". Any suggestion on what i'm doing wrong?

Document code changes need to migrate from mitchellvanw

There will need to be explicit, thorough documentation on what active code changes are needed to migrate over.

Let's put together a list of any changes that need to be made, here. Then write the documentation for them.

Authentication: Driver [doctrine] not supported.

I'm attempting to set up user authentication as per http://www.laraveldoctrine.org/docs/1.0/orm/auth. However, upon setting 'driver' => 'doctrine' in config/auth.php, all routes and CLI commands now give the following error:

[InvalidArgumentException]        
Driver [doctrine] not supported.

As far as I can tell I have the service provider and all facades for Laravel Doctrine registered. Is there something that I'm missing or is this an actual bug? I am using laravel-doctrine/orm 1.0.1

Subscriber/Listener does not exist.

I'm trying to register a event listener and I get InvalidArgumentException. The class does not exist.
Same thing trying to use subscribers.

How would I go back integrating fixtures?

Me again,

Sorry, the title should have been 'How would I go about integrating fixtures'.

I'd like to replace my Laravel seed data with doctrine fixtures, I can't see any configuration options for supporting this. What would be the best approach? Or would I just use the EntityManager within my existing seeds?

Cheers!

[1.1] Run seeders on Doctrine connection

Currently you can use seeders, but you have to use the EntityManager instead of an easy array of input.

Example code:

$connection = $this->container['registry']->getConnection('testing');
$connection->insert('table', [
    'name' => 'value'
]);

When I change the auth driver to doctrine, my blade view is parsed on auth attempt

If I run:

$this->auth->attempt([ 'email'=>"test", 'password'=>"wpefiweo" ]);

My blade view is rendered to the browser. I have searched everywhere, can't find what seems to trigger this behavior. This is what it renders, plain:

@foreach($firstLevel as $item) {{ $item->getLabel() }} @if($item->getChildren()->count() > 0) @endif @if($item->getChildren()->count() > 0) @foreach ($item->getChildren() as $child) {{ $child->getLabel() }} @if($child->getUrl() > 0) @endif @if($child->getChildren()->count() > 0) @foreach ($child->getChildren() as $sub) {{ $sub->getLabel() }} @endforeach @endif @endforeach @endif @endforeach

GedmoExtensions causes artisan doctrine failed

after

composer require "gedmo/doctrine-extensions=^2.4"

and adding

LaravelDoctrine\Extensions\GedmoExtensionsServiceProvider::class,

to my config/app.php, and run

$ php artisan doctrine:schema:validate

gives

Validating for default entity manager...



  [Doctrine\Common\Annotations\AnnotationException]
  [Semantical Error] The annotation "@Doctrine\ORM\Mapping\MappedSuperclass" in class Gedmo\Translatable\Entity\MappedSuperclass\Abs
  tractPersonalTranslation does not exist, or could not be auto-loaded.

Strange doctrine behaviour. Wrong column names in SQL

Hello.
My problem is the strange behaviour of Doctrine. If i use the facade EntityManager in

    $dql = "SELECT h.houseID, h.areaID,
                  h.name, h.address,
                  h.beds, h.baths,
                  h.sqft, h.year,
                  h.rent, h.price
                FROM " . App\Model\EnumEntities::ENT_HOUSE . " h";
    $res = EntityManager::createQuery($dql)->getResult();
    return json_encode(array('data' => $res));

i get the exception:

InvalidFieldNameException in AbstractMySQLDriver.php line 71:
An exception occurred while executing 'SELECT m0_.house_i_d AS house_i_d_0, m0_.area_i_d AS area_i_d_1, m0_.name AS name_2, m0_.address AS address_3, m0_.beds AS beds_4, m0_.baths AS baths_5, m0_.sqft AS sqft_6, m0_.year AS year_7, m0_.rent AS rent_8, m0_.price AS price_9 FROM mx_houses m0_':

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'm0_.house_i_d' in 'field list'

Doctrine uses wrong names of columns with "ID". However, if i set up EntityManager myself, it will work properly

        $dbParams = array(
            'driver'    => DBManager::DRIVER,
            'host'      => DBManager::HOST,
            'user'      => DBManager::USER,
            'password'  => DBManager::PASSWORD,
            'dbname'    => DBManager::DBNAME,
        );
        $this->config = Setup::createAnnotationMetadataConfiguration(array(base_path("app/Model")), true);
        $this->entityManager = EntityManager::create($dbParams, $this->config);

Here is doctrine default manager basic config

'managers'                  => [
        'default' => [
            'dev'        => env('APP_DEBUG', false),
            'meta'       => env('DOCTRINE_METADATA', 'annotations'),
            'connection' => env('DB_CONNECTION', 'mysql'),
            'namespaces' => [
                'App/Model'
            ],
            'paths'      => [
                base_path("app/Model")
            ],
            'repository' => Doctrine\ORM\EntityRepository::class,
            'proxies'    => [
                'namespace'     => false,
                'path'          => storage_path('proxies'),
                'auto_generate' => env('DOCTRINE_PROXY_AUTOGENERATE', false)
            ],
    ],

and entity

namespace App\Model;
use Doctrine\ORM\Mapping\Column,
    Doctrine\ORM\Mapping\Id,
    Doctrine\ORM\Mapping\Entity,
    Doctrine\ORM\Mapping\Table,
    Doctrine\ORM\Mapping\GeneratedValue,
    Doctrine\ORM\Mapping\JoinColumn,
    Doctrine\ORM\Mapping\OneToOne;

/**
 * @Entity
 * @Table(name="mx_houses")
 **/
class House
{
    /**
     * @Id
     * @Column(type="integer")
     * @GeneratedValue(strategy="AUTO")
     * @var int
     **/
    protected $houseID;

    /**
     * @Column(type="integer")
     * @var int
     **/
    protected $areaID;

    /**
     * @Column(type="string", length=100)
     * @var string
     **/
    protected $name;

    /**
     * @Column(type="string", length=255)
     * @var string
     **/
    protected $address;

    /**
     * @Column(type="string", length=5)
     * @var string
     **/
    protected $beds;

    /**
     * @Column(type="string", length=5)
     * @var string
     **/
    protected $baths;

    /**
     * @Column(type="smallint")
     * @var int
     **/
    protected $sqft;

    /**
     * @Column(columnDefinition="YEAR", nullable=false)
     * @var string
     **/
    protected $year;

    /**
     * @Column(type="smallint")
     * @var int
     **/
    protected $rent;

    /**
     * @Column(type="integer")
     * @var int
     **/
    protected $price;

Illuminate\Cache is not compatible with Lumen

I'm getting this error since 1.0.10

[Illuminate\Contracts\Container\BindingResolutionException]
  Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\Cache\CacheManager

It seems that Illuminate\Cache\CacheManager has a dependency with Illuminate\Foundation\Application that does not exist in lumen (it's Laravel\Lumen\Application). I think that illuminate/cache package is not compatible with Lumen

[1.0] Memcache provider not working

I'm getting this error.

BindingResolutionException in Container.php line 823:
Unresolvable dependency resolving [Parameter #0 [ <required> $memcached ]] in class Illuminate\Cache\MemcachedStore

[1.0] Container error when binding repositories

Apologies, me again,

I keep getting:

[Illuminate\Contracts\Container\BindingResolutionException]
  Unresolvable dependency resolving [Parameter #0 [ <required> $em ]] in class Doctrine\ORM\Entity
  Repository

I'm binding my repo as followed within my service provider class

$this->app->bind(NodeRepository::class, function($app) {
            return new \SixtyFiveTwenty\Repositories\Node\NodeRepository(
                app('em'),
                new ClassMetadata('\SixtyFiveTwenty\Entities\Node\Node')
            );
});

Extensions are not being booted in lumen

$this->app['events']->listen('router.matched', function () {
            $this->app->make(ExtensionManager::class)->boot();
        });

Lumen 5.1 does not contain the event 'router.matched' it's only available in Illuminate\Router
therefore it extensions are not being booted in Lumen.

I also find it a rather strange "location" to boot the extensions when router.matched is fired, is there a reason for it?

By placing the booting of the extension manager outside the listener it's booting the extensions again.

[1.0] Resolve target entity Listener

Hi,
I need to relate 2 different type of contacts with a message

Acme\Entity\Message:
  oneToOne:
    from:
      targetEntity: Acme\Entity\ParticipantInterface
--------------
class Message {

   private $from;
   private $to;

   __ public function __construct(ParticipantInterface $from, ParticipantInterface $to)
   {
      $this->from = $from;
      $this->to = $to;
   }
}

class Hotel implements PartecipantInterface
{
    private $name;
    ...
}

class Contact implements PartecipantInterface
{
    private $name;
    ...
}

Message::from and Message::to can be either Hotel or Contact. I thought of this:

Message:
id | from | to
1  |    5   | 6
---------------------------------
Partecipant:
id | message_id
5  |    1
6  |    1
---------------------------------
HotelPartecipant:
id | id_partecipant | id_hotel
1  | 5                     |  100
---------------------------------
ContactPartecipant:
id | id_contact | id_contact
1  | 6               | 50

I was hoping to use this tecnique:
https://www.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/resolve-target-entity-listener.html

but doesn't work

Proxy configuration occurs in wrong place

I had to stick my ’proxies’ => [ ] in the ’meta’ array in my config in order for the EM to pick up my custom path for proxies, but the default config shows proxies as going inside a manager array.

Here the EM is created and resolves proxy settings from the meta key in the manager array (by getting the settings and driver from the meta array in config). So if we don’t have proxies in the meta array under the driver we are using it uses defaults

However farther down the EM setup function we set proxies settings from the correct key in the manager array, but it doesn’t do anything!

Any suggestions @patrickbrouwers?

[1.1] doctrine:generate:entities command

In particular I would like the ability to generate getters and setters for the entities like Symfony. Symfony uses php app/console doctrine:generate:entity, doctrine console php vendor/bin/doctrine orm:generate-entities.

I have create this command looking at doctrine command class but not seem works:

<?php namespace LaravelDoctrine\ORM\Console;

use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\ORM\Tools\Console\MetadataFilter;
use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory;
use Doctrine\ORM\Tools\EntityGenerator;

class GenerateEntitiesCommand extends Command
{
    /**
     * The name and signature of the console command.
     * @var stringr
     */
    protected $signature = 'doctrine:generate:entities
    {-- filter=* : A string pattern used to match entities that should be processed.}
    {--em= : Generate getter and setter for a specific entity manager. },
    {--generate-annotations= : Flag to define if generator should generate annotation metadata on entities.}
    {--generate-methods= : Flag to define if generator should generate stub methods on entities.}
    {--regenerate-entities= : Flag to define if generator should regenerate entity if it exists.}
    {--update-entities= : Flag to define if generator should only update entity if it exists.}
    {--extend= : Defines a base class to be extended by generated entity classes.}
    {--num-spaces= : Defines the number of indentation spaces.}
    {--no-backup= : Flag to define if generator should avoid backuping existing entity file if it exists}';

    /**
     * The console command description.
     * @var string
     */
    protected $description = 'Generates Getter and Setter for entity classes.';

    /**
     * Execute the console command.
     *
     * @param ManagerRegistry $registry
     * @throws InvalidArgumentException
     */
    public function fire(ManagerRegistry $registry)
    {
        $names = $this->option('em') ? [$this->option('em')] : $registry->getManagerNames();

        foreach ($names as $name) {

            $em    = $registry->getManager($name);

            $this->comment('');
            $this->message('Generating getter and setter for <info>' . $name . '</info> entity manager...', 'blue');

            $cmf = new DisconnectedClassMetadataFactory();
            $cmf->setEntityManager($em);
            $metadatas = $cmf->getAllMetadata();
            $metadatas = MetadataFilter::filter($metadatas, $this->option('filter'));

            $destPath = base_path().'/src/Acme;

            if (!is_dir($destPath)) {
                mkdir($destPath, 0777, true);
            }

            $destPath = realpath($destPath);

            if (!file_exists($destPath)) {
                throw new InvalidArgumentException(
                    sprintf("Proxies destination directory '<info>%s</info>' does not exist.",
                        $em->getConfiguration()->getProxyDir())
                );
            }

            if (count($metadatas)) {

                // Create EntityGenerator
                $entityGenerator = new EntityGenerator();

                $entityGenerator->setGenerateAnnotations($this->option('generate-annotations'));
                $entityGenerator->setGenerateStubMethods($this->option('generate-methods'));
                $entityGenerator->setRegenerateEntityIfExists($this->option('regenerate-entities'));
                $entityGenerator->setUpdateEntityIfExists($this->option('update-entities'));
                $entityGenerator->setNumSpaces($this->option('num-spaces'));
                $entityGenerator->setBackupExisting(!$this->option('no-backup'));

                if (($extend = $this->option('extend')) !== null) {
                    $entityGenerator->setClassToExtend($extend);
                }

                foreach ($metadatas as $metadata) {
                    $this->comment(
                        sprintf('Processing entity "<info>%s</info>"', $metadata->name)
                    );
                }

                // Generating Entities
                $entityGenerator->generate($metadatas, $destPath);

                // Outputting information message
                $this->comment(PHP_EOL . sprintf('Entity classes generated to "<info>%s</INFO>"', $destPath));
            }
        }
    }
}

Unit testing

Hi, please, how can i testing ORM library with PHP unit? I have environment configuration in phpunit.xml file for SQLITE memory database, but ORM library stay use default MYSQL configuration from database.php configuration file and mixing it with SQLITE testing configuration.

I get this error from PHPUnit test environment (SQLSTATE[HY000] [1049] Unknown database ':memory:'):

Failed asserting that exception of type "Doctrine\DBAL\Exception\ConnectionException" matches expected exception "\InvalidArgumentException". Message was: "An exception occured in driver: SQLSTATE[HY000] [1049] Unknown database ':memory:'" at
#0 /xxx\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))
#1 /xxx/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(47): Doctrine\DBAL\DBALException::driverException(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException))
#2 /xxx/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOMySql\Driver->connect(Array, 'user', 'password', Array)
#3 /xxx/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1166): Doctrine\DBAL\Connection->connect()
#4 /xxx/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(230): Doctrine\DBAL\Connection->beginTransaction()
#5 /xxx/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php(85): Doctrine\ORM\EntityManager->transactional(Object(Closure))
#6 /xxx/tests/phpunit/Application/Protocol/RetrieveProtocolsTest.php(69): Doctrine\Common\DataFixtures\Executor\ORMExecutor->execute(Array)
#7 [internal function]: yyy\Tests\Application\Protocol\RetrieveProtocolsTest->testRetrieveProtocolsInvalidArgumentException()
#8 /xxx/vendor/phpunit/phpunit/src/Framework/TestCase.php(881): ReflectionMethod->invokeArgs(Object(yyy\Tests\Application\Protocol\RetrieveProtocolsTest), Array)
#9 /xxx/vendor/phpunit/phpunit/src/Framework/TestCase.php(746): PHPUnit_Framework_TestCase->runTest()
#10 /xxx/vendor/phpunit/phpunit/src/Framework/TestResult.php(601): PHPUnit_Framework_TestCase->runBare()
#11 /xxx/vendor/phpunit/phpunit/src/Framework/TestCase.php(702): PHPUnit_Framework_TestResult->run(Object(yyy\Tests\Application\Protocol\RetrieveProtocolsTest))
#12 /xxx/vendor/phpunit/phpunit/src/Framework/TestSuite.php(735): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#13 /xxx/vendor/phpunit/phpunit/src/Framework/TestSuite.php(735): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#14 /xxx/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(432): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#15 /xxx/vendor/phpunit/phpunit/src/TextUI/Command.php(148): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array)
#16 /xxx/vendor/phpunit/phpunit/src/TextUI/Command.php(100): PHPUnit_TextUI_Command->run(Array, true)
#17 /xxx/vendor/phpunit/phpunit/phpunit(47): PHPUnit_TextUI_Command::main()
#18 {main}.

DB environment configuration from phpunit.xml file:

<env name="APP_ENV" value="testing"/>
<env name="APP_DEBUG" value="true"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DRIVER" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="DOCTRINE_METADATA" value="annotations"/>
<env name="DOCTRINE_PROXY_AUTOGENERATE" value="true"/>

Configuration for sqlite connection from database.php file:

'default' => env('DB_CONNECTION', 'mysql'),
'connections' => array(
    'mysql' => array(
        ...
    ),
    'sqlite' => array(
        'driver' => env('DB_DRIVER', 'sqlite'),
        'database'  => env('DB_DATABASE'),
        'prefix'   => ''
    )
)
...

DB default manager configuration from doctrine.php configuration file:

'managers' => [
    'default' => [
        'dev'        => env('APP_DEBUG'),
        'meta'       => env('DOCTRINE_METADATA', 'annotations'),
        'connection' => env('DB_CONNECTION'),
...

Thank You.

SimpleObjectsToCollectionHydrator causes Doctrine\ORM\Persisters\Entity\BasicEntityPersister throws ErrorException

    public function load(array $criteria, $entity = null, $assoc = null, array $hints = array(), $lockMode = null, $limit = null, array $orderBy = null)
    {
        ...

        $hydrator = $this->em->newHydrator($this->currentPersisterContext->selectJoinSql ? Query::HYDRATE_OBJECT : Query::HYDRATE_SIMPLEOBJECT);
        $entities = $hydrator->hydrateAll($stmt, $this->currentPersisterContext->rsm, $hints);

        return $entities ? $entities[0] : null;
    }

when $entities is an empty Illuminate\Support\Collection, $entityies[0] causes an ErrorException

1.0.7 breaks routing in Laravel 5.1.20

A change in 1.0.7 introduced unintentional bug in Laravel's routing mechanism.
If a route is defined using the class keyword for resolving the class name like here
Route::resource('some-route', \App\Http\Controllers\Controller::class);
Laravel will try to resolve a file from namespace App\Http\Controllers\Controller\App\Http\Controllers\Controller instead of \App\Http\Controllers\Controller.
On the other hand passing a string containing the fully qualified namespace of the file will work and will not break the routing.

[1.1] Easier Timestampable and Softdeletable

  • Provide an own implementation of Timestampable and Softdeletable
  • Should support all mapping drivers (Fluent as well)
  • No Gedmo extensions needed
  • Support both Carbon and DateTime, right date strategy should be choosen

Document code changes need to migrate from atrauzzi

There will need to be explicit, thorough documentation on what active code changes are needed to migrate over.

Let's put together a list of any changes that need to be made, here. Then write the documentation for them.

Listeners / Subscribers should resolve through the DI Container

At the moment adding listeners calls something like this

if (!class_exists($listener, false)) {
     throw new InvalidArgumentException("Listener {$listener} does not exist");
}

$manager->getEventManager()->addEventListener($event, new $listener);

This doesn't resolve listeners from the Container, so they won't have any dependencies injected etc.

Obviously switching this to work through the container is probably just as simple as:

try {
     $resolvedListener = $this->container->make($listener);
} catch (ReflectionException $e) {
     throw new InvalidArgumentException("Listener {$listener} could not be resolved: {$e->getMessage()}");
}

$manager->getEventManager()->addEventListener($event, $resolvedListener);

But I'm worried that this might be a problem given how the DoctrineServiceProvider works.

The provider does most of its work in register() and this includes adding these listeners.

DoctrineServiceProvider::registerManagerRegistry() sets up the registry to call IlluminateRegistry::addManager(), which will trigger the adding of listeners.

Because we then make use of the registered Registry in DoctrineServiceProvider::registerEntityManager this code will get run during the Provider's register phase.

If we make a change as above to resolve listeners from the container this means that we may call make() before a dependency has been registered, which would break the application.

To my mind listeners being resolved from the container is what would be expected from a Laravel package, but this may require changes to how the service provider works?

I've noticed that DoctrineServiceProvider is deferred, does this mitigate this issue?

Oracle database Mapping

Hi, I generated entities from mysql database, it's work. But now I need do same in oracle database.
When I run this for one table:

vendor\bin\doctrine orm:convert:mapping --from-database -v --filter=USERS annotation domain

I get this:

doctrine-orm-convert-mapping

The "--filter" option not work?

Cannot use Symfony\Component\Console\Command\Command as Command because the name is already in use

When trying to publich vendor

php artisan vendor:publish --tag="config"

PHP Fatal error: Cannot use Symfony\Component\Console\Command\Command as Command because the name is already in use in /var/www/html/laravel-doctrine/vendor/laravel-doctrine/orm/src/Console/ConvertConfigCommand.php on line 17

[Symfony\Component\Debug\Exception\FatalErrorException]
Cannot use Symfony\Component\Console\Command\Command as Command because the name is already in use

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.