Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
da05347
Implement templates for Attrauzi config building
FoxxMD Sep 14, 2015
89b3b2b
Refactor some templates to use escaped single quotes
FoxxMD Sep 14, 2015
d2b539e
Refactor commands with right namespace (and for templates)
FoxxMD Sep 14, 2015
30cefd0
Implement Atrauzzi config migrator
FoxxMD Sep 14, 2015
fd8494b
Implement tests for migrator commands
FoxxMD Sep 14, 2015
c60de73
Modify config sample to include more options
Sep 14, 2015
21b162b
Bug fixes and manager section implementation for atrauzzi migrator
FoxxMD Sep 14, 2015
ed5b266
Bug fix on mitchell migrator when specifying a repository
FoxxMD Sep 14, 2015
f665fe2
Use storage_path variable included in tests
FoxxMD Sep 14, 2015
12bca96
Cleaner storage_path solution
FoxxMD Sep 14, 2015
81f28f7
storage_path where everyone plays nicely
FoxxMD Sep 14, 2015
05bcfa2
Update gitignore for cached files directory during tests
FoxxMD Sep 14, 2015
466db27
Move migrator tests into Console folder
patrickbrouwers Sep 14, 2015
e3f800b
Merge pull request #33 from laravel-doctrine/migrator_command
patrickbrouwers Sep 14, 2015
3c4365c
Fix Cannot use Symfony\Component\Console\Command\Command as Command +…
patrickbrouwers Sep 15, 2015
0dd657d
Docblock + CS
patrickbrouwers Sep 15, 2015
6975434
Fix missing cache index on master template
FoxxMD Sep 15, 2015
23db950
Cleanup config migrator tests
FoxxMD Sep 15, 2015
33c4efe
Dynamically instantiate config migrator class
FoxxMD Sep 15, 2015
f642bc0
Typo in test parameter
FoxxMD Sep 15, 2015
f7694f6
Remove meta block from master template
FoxxMD Sep 15, 2015
ee3d149
php-cs-fixer cleanup
FoxxMD Sep 15, 2015
fd3f4b9
Merge pull request #36 from laravel-doctrine/migrator_command
patrickbrouwers Sep 15, 2015
7c17d18
Updating config as Laravel does
Amrit01 Sep 15, 2015
0bb3bd1
Merge pull request #38 from Amrit01/master
patrickbrouwers Sep 15, 2015
6f5c2ef
Jsonable and Arrayable for Entities
patrickbrouwers Sep 15, 2015
f4a7672
Add other packages to suggest
patrickbrouwers Sep 15, 2015
b7342f2
Add HHVM and PHP7.0 to travis
patrickbrouwers Sep 15, 2015
764b76d
Fix tests for PHP7.0
patrickbrouwers Sep 15, 2015
3b2a602
Add ConnectionManager to service provider
FoxxMD Sep 15, 2015
24a22d8
Merge remote-tracking branch 'origin/master'
FoxxMD Sep 15, 2015
91f9b97
Add Metadata and Cache Manager to service provider
FoxxMD Sep 15, 2015
4e0537f
Fix LaravelDebugbarLogger
patrickbrouwers Sep 15, 2015
f0e9693
Cant' create and bind the same manager twice
patrickbrouwers Sep 15, 2015
8bcd2a9
Share debugstack through connections, to support multiple connections…
patrickbrouwers Sep 15, 2015
51d1757
Fix default manager binding
patrickbrouwers Sep 16, 2015
002df8e
Fixing incorrect function name
DanWithams Sep 16, 2015
9f901b5
Merge pull request #39 from DanWithams/add-connect-fix
patrickbrouwers Sep 16, 2015
7f23089
CS
patrickbrouwers Sep 16, 2015
987bfa5
Fix expire in PasswordResets
patrickbrouwers Sep 17, 2015
a55653d
Match php-cs-fixer with StyleCI
patrickbrouwers Sep 17, 2015
3dec2a9
Applied fixes from StyleCI
patrickbrouwers Sep 17, 2015
dd3d99a
Merge pull request #40 from laravel-doctrine/analysis-8joEZX
patrickbrouwers Sep 17, 2015
c177e37
Add StyleCI badge
patrickbrouwers Sep 17, 2015
4d4cf8f
Remove the CanResetPassword trait because this is a exact duplicate o…
patrickbrouwers Sep 17, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ composer.lock
.DS_Store
.php_cs.cache

/tests/Stubs/storage/framework/views/*
!/tests/Stubs/storage/framework/views/.gitkeep
/tests/Stubs/storage/doctrine.generated.php
.idea
laravel-doctrine-orm.iml
2 changes: 1 addition & 1 deletion .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ return Symfony\CS\Config\Config::create()
->setUsingCache(true)
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->fixers(array(
'psr0',
'psr4',
'encoding',
'short_tag',
'blankline_after_open_tag',
Expand Down
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ language: php
php:
- 5.5
- 5.6
- 7.0
- hhvm

before_script:
- travis_retry composer self-update
Expand All @@ -12,6 +14,8 @@ after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover

sudo: false

script: phpunit --coverage-clover=coverage.clover

matrix:
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<img src="https://cloud.githubusercontent.com/assets/7728097/9831648/1827b704-5960-11e5-982d-98c8fc8dcacd.jpg"/>

[![GitHub release](https://img.shields.io/github/release/laravel-doctrine/orm.svg?style=flat)](https://packagist.org/packages/laravel-doctrine/orm)
[![Travis](https://img.shields.io/travis/laravel-doctrine/orm.svg?style=flat)](https://travis-ci.org/laravel-doctrine/orm)
[![Scrutinizer](https://img.shields.io/scrutinizer/g/laravel-doctrine/orm.svg?style=flat)](https://github.com/laravel-doctrine/orm)
[![Packagist](https://img.shields.io/packagist/dd/laravel-doctrine/orm.svg?style=flat)](https://packagist.org/packages/laravel-doctrine/orm)
[![Packagist](https://img.shields.io/packagist/dm/laravel-doctrine/orm.svg?style=flat)](https://packagist.org/packages/laravel-doctrine/orm)
[![Packagist](https://img.shields.io/packagist/dt/laravel-doctrine/orm.svg?style=flat)](https://packagist.org/packages/laravel-doctrine/orm)
[![GitHub release](https://img.shields.io/github/release/laravel-doctrine/orm.svg?style=flat-square)](https://packagist.org/packages/laravel-doctrine/orm)
[![Travis](https://img.shields.io/travis/laravel-doctrine/orm.svg?style=flat-square)](https://travis-ci.org/laravel-doctrine/orm)
[![StyleCI](https://styleci.io/repos/39036008/shield)](https://styleci.io/repos/39036008)
[![Scrutinizer](https://img.shields.io/scrutinizer/g/laravel-doctrine/orm.svg?style=flat-square)](https://github.com/laravel-doctrine/orm)
[![Packagist](https://img.shields.io/packagist/dm/laravel-doctrine/orm.svg?style=flat-square)](https://packagist.org/packages/laravel-doctrine/orm)
[![Packagist](https://img.shields.io/packagist/dt/laravel-doctrine/orm.svg?style=flat-square)](https://packagist.org/packages/laravel-doctrine/orm)

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

Expand Down Expand Up @@ -53,13 +53,13 @@ Require this package
After adding the package, add the ServiceProvider to the providers array in `config/app.php`

```php
'LaravelDoctrine\ORM\DoctrineServiceProvider',
LaravelDoctrine\ORM\DoctrineServiceProvider::class,
```

Optionally you can register the EntityManager facade:

```php
'EntityManager' => 'LaravelDoctrine\ORM\Facades\EntityManager'
'EntityManager' => LaravelDoctrine\ORM\Facades\EntityManager::class
```

To publish the config use:
Expand Down
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"illuminate/pagination": "~5.1",
"illuminate/support": "~5.1",
"illuminate/validation": "~5.1",
"illuminate/view": "~5.1"
"illuminate/view": "~5.1",
"symfony/serializer": "^2.7"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
Expand All @@ -46,6 +47,9 @@
]
},
"suggest": {
"laravel-doctrine/acl": "to integrate Doctrine roles & permissions with Laravel's Authorization system (~1.0)",
"laravel-doctrine/extensions": "to add Behavioral and Query/Type Extensions for Laravel Doctrine (~1.0)",
"laravel-doctrine/migrations": "to add support for migrations in Laravel Doctrine (~1.0)",
"yajra/laravel-oci8": "Support for Laravel native queue and session database drivers in Oracle (~2.0)."
}
}
18 changes: 9 additions & 9 deletions src/Auth/Authenticatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ trait Authenticatable
*/
protected $rememberToken;

/**
* Get the column name for the primary key
* @return string
*/
public function getAuthIdentifierName()
{
return 'id';
}

/**
* Get the unique identifier for the user.
* @return mixed
Expand All @@ -25,15 +34,6 @@ public function getAuthIdentifier()
return $this->{$name};
}

/**
* Get the column name for the primary key
* @return string
*/
public function getAuthIdentifierName()
{
return 'id';
}

/**
* @return string
*/
Expand Down
15 changes: 0 additions & 15 deletions src/Auth/CanResetPassword.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Auth/Passwords/PasswordResetServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function registerTokenRepository()
return new DoctrineTokenRepository(
$this->app->make(ManagerRegistry::class)->getManagerForClass(PasswordReminder::class),
$app['config']['app.key'],
$app['config']->get('auth.reminder.expire', 60)
$app['config']->get('auth.password.expire', 60)
);
});
}
Expand Down
182 changes: 182 additions & 0 deletions src/Console/ConfigMigrations/AtrauzziMigrator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<?php

namespace LaravelDoctrine\ORM\Console\ConfigMigrations;

use Illuminate\Contracts\View\Factory;
use LaravelDoctrine\ORM\Utilities\ArrayUtil;

class AtrauzziMigrator implements ConfigurationMigrator
{
/**
* @var Factory
*/
protected $viewFactory;

/**
* @param Factory $viewFactory
*/
public function __construct(Factory $viewFactory)
{
$this->viewFactory = $viewFactory;
$this->viewFactory->addNamespace('atrauzzi', realpath(__DIR__ . '/templates/atrauzzi'));
$this->viewFactory->addNamespace('laraveldoctrine', realpath(__DIR__ . '/templates/laraveldoctrine'));
}

/**
* Convert a configuration array from another laravel-doctrine project in to a string representation of a php array configuration for this project
*
* @param array $sourceArray
*
* @return string
*/
public function convertConfiguration($sourceArray)
{
$dqls = $this->convertDQL($sourceArray);
$cache = $this->convertCache($sourceArray);
$customTypes = $this->convertCustomTypes($sourceArray);
$managers = [$this->convertManager($sourceArray)];

$results = $this->viewFactory->make('laraveldoctrine.master', [
'managers' => $managers,
'cache' => $cache,
'dqls' => $dqls,
'customTypes' => $customTypes
])->render();

return $this->unescape($results);
}

/**
* @param $sourceArray
*
* @return string
*/
public function convertManager($sourceArray)
{
$proxySettings = ArrayUtil::get($sourceArray['proxy_classes']);
$defaultRepo = ArrayUtil::get($sourceArray['default_repository']);
$namespaces = [];
$connection = ArrayUtil::get($sourceArray['default']);

// Non default configuration
if (count($sourceArray['metadata']) > 1) {
$hasNamespaces = false;
$driver = null;
$sameDriver = true;

foreach ($sourceArray['metadata'] as $key => $item) {
if (is_null($driver)) {
if (is_array($item)) {
$driver = $item['driver'];
} elseif ($key == 'driver') {
$driver = $item;
}
} else {
if (is_array($item) && $item['driver'] != $driver) {
$sameDriver = false;
}
}
if (is_array($item) && isset($item['namespace'])) {
$hasNamespaces = true;
}
}
// Only do this if all the same driver
if ($hasNamespaces && $sameDriver) {
$driver = $sourceArray['metadata'][0]['driver'];

// Convert each metadata entry into a namespace entry
foreach ($sourceArray['metadata'] as $item) {
if (isset($item['alias'])) {
$namespaces[$item['alias']] = $item['namespace'];
} else {
array_push($namespaces, $item['namespace']);
}
}
// Only specifying one non-default EM
} else {
if (isset($sourceArray['metadata']['namespace'])) {
if (isset($sourceArray['metadata']['alias'])) {
$namespaces[$sourceArray['metadata']['alias']] = $sourceArray['metadata']['namespace'];
} else {
$namespaces[] = $sourceArray['metadata']['namespace'];
}
}
}
// One EM, default
} else {
$driver = $sourceArray['metadata']['driver'];
}

$results = $this->viewFactory->make('atrauzzi.manager', [
'namespaces' => $namespaces,
'proxySettings' => $proxySettings,
'defaultRepo' => $defaultRepo,
'driver' => $driver,
'connection' => $connection
])->render();

return $this->unescape($results);
}

/**
* @param $sourceArray
*
* @return string
*/
public function convertCustomTypes($sourceArray)
{
$results = $this->viewFactory->make('atrauzzi.customTypes', [
'sourceArray' => $sourceArray
])->render();

return $this->unescape($results);
}

/**
* Convert a cache section from mitchellvanw/laravel-doctrine to a string representation of a php array configuration for a cache section for this project
*
* @param array $sourceArray
*
* @return string
*/
public function convertCache($sourceArray)
{
if (isset($sourceArray['cache']['provider'])) {
$cacheProvider = ArrayUtil::get($sourceArray['cache']['provider']);
$results = $this->viewFactory->make('atrauzzi.cache', [
'cacheProvider' => $cacheProvider,
'extras' => count($sourceArray['cache']) > 1
//if user is mimicking cache arrays here we need to tell them to move these to cache.php
])->render();

return $this->unescape($results);
}

return null;
}

/**
* Convert the dql sections from the entity managers in a configuration from atruazzi/laravel-doctrine into a string representation of a php array configuration for custom string/numeric/datetime functions
* Returns null if no dql sections were found.
*
* @param $sourceArray
*
* @return null|string
*/
public function convertDQL($sourceArray)
{
$results = $this->viewFactory->make('atrauzzi.dql', ['dql' => $sourceArray])->render();

return $this->unescape($results);
}

/**
* @param $results
*
* @return string
*/
protected function unescape($results)
{
return html_entity_decode($results, ENT_QUOTES);
}
}
2 changes: 1 addition & 1 deletion src/Console/ConfigMigrations/ConfigurationMigrator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LaravelDoctrine\ORM\ConfigMigrations;
namespace LaravelDoctrine\ORM\Console\ConfigMigrations;

use Illuminate\Contracts\View\Factory;

Expand Down
Loading