Skip to content

Commit

Permalink
extend transaction (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
ytake committed Apr 22, 2017
1 parent e214ab0 commit 401ef4d
Show file tree
Hide file tree
Showing 70 changed files with 408 additions and 129 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2016 Yuuki Takezawa
Copyright (c) 2015-2017 Yuuki Takezawa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ you must use the TransactionalModule

| params | description |
|-----|-------|
| value | database connection |
| value (or array) | database connection |
| expect | expect exception |

```php
Expand All @@ -157,7 +157,21 @@ use Ytake\LaravelAspect\Annotation\Transactional;
*/
public function save(array $params)
{
return $this->eloquent->save($params)
return $this->eloquent->save($params);
}
```

#### Multiple Transaction
```php
use Ytake\LaravelAspect\Annotation\Transactional;

/**
* @Transactional({"master", "second_master"})
*/
public function save(array $params)
{
$this->eloquent->save($params);
$this->query->save($params);
}
```

Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
"illuminate/log": "~5.0",
"illuminate/database": "~5.0",
"illuminate/cache": "~5.0",
"illuminate/events": "~5.0",
"ray/aop": "~2.0",
"nikic/php-parser": "^1.0|^2.0",
"doctrine/annotations": "~1.0"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/AnnotationReaderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Annotation;
Expand Down
3 changes: 2 additions & 1 deletion src/Annotation/Async.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Annotation;

use Doctrine\Common\Annotations\Annotation;

/**
* @deprecated
* @Annotation
* @Target("METHOD")
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/CacheEvict.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Annotation;
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/CachePut.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Annotation;
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Cacheable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Annotation;
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/LogExceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Annotation;
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/Loggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Annotation;
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/LoggableAnnotate.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Annotation;
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/PostConstruct.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Annotation;
Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/RequireAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Annotation/RetryOnFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Annotation;
Expand Down
4 changes: 2 additions & 2 deletions src/Annotation/Transactional.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Annotation;
Expand All @@ -26,7 +26,7 @@
*/
final class Transactional extends Annotation
{
/** @var null $connection database connection */
/** @var null|string|array $value database connection names */
public $value = null;

/** @var string */
Expand Down
2 changes: 1 addition & 1 deletion src/AnnotationConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect;
Expand Down
2 changes: 1 addition & 1 deletion src/AspectBind.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect;
Expand Down
2 changes: 1 addition & 1 deletion src/AspectDriverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect;
Expand Down
2 changes: 1 addition & 1 deletion src/AspectManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect;
Expand Down
33 changes: 1 addition & 32 deletions src/AspectServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect;
Expand Down Expand Up @@ -67,35 +67,4 @@ public function provides()
'aspect.manager',
];
}

/**
* {@inheritdoc}
*/
public static function compiles()
{
return [
base_path() . '/vendor/ytake/laravel-aspect/src/AspectServiceProvider.php',
base_path() . '/vendor/ytake/laravel-aspect/src/ConsoleServiceProvider.php',
base_path() . '/vendor/ytake/laravel-aspect/src/AspectBind.php',
base_path() . '/vendor/ytake/laravel-aspect/src/AspectDriverInterface.php',
base_path() . '/vendor/ytake/laravel-aspect/src/NullAspectKernel.php',
base_path() . '/vendor/ytake/laravel-aspect/src/RayAspectKernel.php',
base_path() . '/vendor/ytake/laravel-aspect/src/PointCut/CacheablePointCut.php',
base_path() . '/vendor/ytake/laravel-aspect/src/PointCut/CacheEvictPointCut.php',
base_path() . '/vendor/ytake/laravel-aspect/src/PointCut/CachePutPointCut.php',
base_path() . '/vendor/ytake/laravel-aspect/src/PointCut/LoggablePointCut.php',
base_path() . '/vendor/ytake/laravel-aspect/src/PointCut/PointCutable.php',
base_path() . '/vendor/ytake/laravel-aspect/src/PointCut/TransactionalPointCut.php',
base_path() . '/vendor/ytake/laravel-aspect/src/Modules/CacheableModule.php',
base_path() . '/vendor/ytake/laravel-aspect/src/Modules/CacheEvictModule.php',
base_path() . '/vendor/ytake/laravel-aspect/src/Modules/CachePutModule.php',
base_path() . '/vendor/ytake/laravel-aspect/src/Modules/LoggableModule.php',
base_path() . '/vendor/ytake/laravel-aspect/src/Modules/TransactionalModule.php',
base_path() . '/vendor/ytake/laravel-aspect/src/Interceptor/CacheableInterceptor.php',
base_path() . '/vendor/ytake/laravel-aspect/src/Interceptor/CacheEvictInterceptor.php',
base_path() . '/vendor/ytake/laravel-aspect/src/Interceptor/CachePutInterceptor.php',
base_path() . '/vendor/ytake/laravel-aspect/src/Interceptor/LoggableInterceptor.php',
base_path() . '/vendor/ytake/laravel-aspect/src/Interceptor/TransactionalInterceptor.php',
];
}
}
2 changes: 1 addition & 1 deletion src/Console/ClearCacheCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Console;
Expand Down
2 changes: 1 addition & 1 deletion src/Console/CompileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Console;
Expand Down
2 changes: 1 addition & 1 deletion src/Console/ModulePublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Console;
Expand Down
2 changes: 1 addition & 1 deletion src/ConsoleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect;
Expand Down
7 changes: 5 additions & 2 deletions src/ContainerInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/

namespace Ytake\LaravelAspect;

use Ray\Aop\Bind;
Expand Down Expand Up @@ -43,13 +44,15 @@ public function __construct(Container $container)
* @param string $abstract
* @param Bind $bind
* @param string $className
*
* @return bool
*/
public function intercept($abstract, Bind $bind, $className)
{
if ($abstract === $className) {
return false;
}

if (isset($this->container->contextual[$abstract])) {
$this->resolveContextualBindings($abstract, $className);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/ClassNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Exception;
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/FileNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Exception;
Expand Down
2 changes: 1 addition & 1 deletion src/Interceptor/AbstractCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Interceptor;
Expand Down
2 changes: 1 addition & 1 deletion src/Interceptor/AbstractLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Interceptor;
Expand Down
4 changes: 2 additions & 2 deletions src/Interceptor/AsyncInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Interceptor;
Expand All @@ -24,7 +24,7 @@

/**
* Class AsyncInterceptor
*
* @deprecated
* @codeCoverageIgnore
*/
class AsyncInterceptor implements MethodInterceptor
Expand Down
2 changes: 1 addition & 1 deletion src/Interceptor/CacheEvictInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Interceptor;
Expand Down
2 changes: 1 addition & 1 deletion src/Interceptor/CachePutInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
* Copyright (c) 2015-2016 Yuuki Takezawa
* Copyright (c) 2015-2017 Yuuki Takezawa
*
*/
namespace Ytake\LaravelAspect\Interceptor;
Expand Down

0 comments on commit 401ef4d

Please sign in to comment.