Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10 move namespace to yetopen #14

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Yii2 ActiveRecord History Extension for Yii 2
=========================

> *The original repository was cloned from [here](https://github.com/nhkey/yii2-activerecord-history)*

This extension adds storage history of changes to the AR model


Expand All @@ -12,27 +14,27 @@ The preferred way to install this extension is through [composer](http://getcomp
Either run

```
php composer.phar require nhkey/yii2-activerecord-history "*"
php composer.phar require yetopen/yii2-activerecord-history "*"
```

or add

```json
"nhkey/yii2-activerecord-history": "*"
"yetopen/yii2-activerecord-history": "*"
```

to the require section of your composer.json.

If you are using DBManager as Manager, you need to run

```
php yii migrate --migrationPath=@vendor/nhkey/yii2-activerecord-history/migrations
php yii migrate --migrationPath=@vendor/yetopen/yii2-activerecord-history/migrations
```

Add in `config/web.php` in the modules section the configuration.
```php
'arh' => [
'class' => '\nhkey\arh\Module',
'class' => '\yetopen\arh\Module',
'allowedPermissions' => ['visualizzaStoricoModifiche']
],
```
Expand All @@ -41,18 +43,18 @@ Usage
-----

If the property is not specified, the default manager is DBManager.
In the extension is two managers: [DBManager](https://github.com/nhkey/yii2-activerecord-history/blob/master/docs/en/managers.md#dbmanager) and [FileManager](https://github.com/nhkey/yii2-activerecord-history/blob/master/docs/en/managers.md#filemanager). You can extend the class BaseManager.
In the extension is two managers: [DBManager](https://github.com/yetopen/yii2-activerecord-history/blob/master/docs/en/managers.md#dbmanager) and [FileManager](https://github.com/yetopen/yii2-activerecord-history/blob/master/docs/en/managers.md#filemanager). You can extend the class BaseManager.

There are two way how usage this extension:
- [As behavior](https://github.com/nhkey/yii2-activerecord-history/blob/master/docs/en/usage-as-behavior.md)
- [As extend the class ActiveRecord](https://github.com/nhkey/yii2-activerecord-history/blob/master/docs/en/usage-as-extend.md) **DEPRECATED**
- [As behavior](https://github.com/yetopen/yii2-activerecord-history/blob/master/docs/en/usage-as-behavior.md)
- [As extend the class ActiveRecord](https://github.com/yetopen/yii2-activerecord-history/blob/master/docs/en/usage-as-extend.md) **DEPRECATED**

Update to 1.1.2
-------
For update you need to run:

```
php yii migrate --migrationPath=@vendor/nhkey/yii2-activerecord-history/migrations
php yii migrate --migrationPath=@vendor/yetopen/yii2-activerecord-history/migrations
```

Credits
Expand Down
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "nhkey/yii2-activerecord-history",
"name": "yetopen/yii2-activerecord-history",
"description": "Storage history of changes to ActiveRecord",
"keywords": ["yii2", "history", "activerecord"],
"type": "yii2-extension",
Expand All @@ -9,12 +9,16 @@
{
"name": "Mikhail Mikhalev",
"email": "[email protected]"
},
{
"name": "YetOpen",
"email": "[email protected]"
}
],
"require": {
"yiisoft/yii2": "*"
},
"autoload": {
"psr-4": { "nhkey\\arh\\": "src\\" }
"psr-4": { "yetopen\\arh\\": "src\\" }
}
}
4 changes: 2 additions & 2 deletions docs/en/managers.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ DBManager is manager for saving your ActiveRecord-object's history in database.
For use you need run

```
php yii migrate --migrationPath=@vendor/nhkey/yii2-activerecord-history/migrations
php yii migrate --migrationPath=@vendor/yetopen/yii2-activerecord-history/migrations
```


Expand All @@ -30,4 +30,4 @@ FileManager is manager for saving your ActiveRecord-object's history in filesyst
- **filename** - filename for file with history log;


[Back To Main page](https://github.com/nhkey/yii2-activerecord-history/blob/master/README.md)
[Back To Main page](https://github.com/yetopen/yii2-activerecord-history/blob/master/README.md)
26 changes: 13 additions & 13 deletions docs/en/usage-as-behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Easy way:
class MyClass extends ActiveRecord {
public function behaviors(){
return [
\nhkey\arh\ActiveRecordHistoryBehavior::className(),
\yetopen\arh\ActiveRecordHistoryBehavior::className(),
...
];
}
Expand All @@ -19,7 +19,7 @@ If you want use not default manager or set options for manager, you may use this
public function behaviors(){
return [
'history' => [
'class' => \nhkey\arh\ActiveRecordHistoryBehavior::className(),
'class' => \yetopen\arh\ActiveRecordHistoryBehavior::className(),
'manager' => 'ManagerName',
'managerOptions' => [
...
Expand All @@ -30,14 +30,14 @@ If you want use not default manager or set options for manager, you may use this
}
```

If you don't want to save some fields, you can use property ignoreFields (example, field "updated_at" if you use TimestampBehavior, [Issue #1](https://github.com/nhkey/yii2-activerecord-history/issues/1))
If you don't want to save some fields, you can use property ignoreFields (example, field "updated_at" if you use TimestampBehavior, [Issue #1](https://github.com/yetopen/yii2-activerecord-history/issues/1))

```php
class MyClass extends ActiveRecord {
public function behaviors(){
return [
'history' => [
'class' => \nhkey\arh\ActiveRecordHistoryBehavior::className(),
'class' => \yetopen\arh\ActiveRecordHistoryBehavior::className(),
'ignoreFields' => ['updated_at', 'some_other_field'],
],
...
Expand Down Expand Up @@ -76,15 +76,15 @@ If you need to retrieve the value of an attribute at a specific date-time, use t

### Example 1

[FileManager](https://github.com/nhkey/yii2-activerecord-history/blob/master/docs/en/managers.md#filemanager):
[FileManager](https://github.com/yetopen/yii2-activerecord-history/blob/master/docs/en/managers.md#filemanager):

```php
class MyClass extends ActiveRecord {
public function behaviors(){
return [
'history' => [
'class' => \nhkey\arh\ActiveRecordHistoryBehavior::className(),
'manager' => '\nhkey\arh\managers\FileManager',
'class' => \yetopen\arh\ActiveRecordHistoryBehavior::className(),
'manager' => '\yetopen\arh\managers\FileManager',
'managerOptions' => [
'filePath' => '/home/logs/',
'isGenerateFilename' => true
Expand All @@ -101,8 +101,8 @@ or
public function behaviors(){
return [
'history' => [
'class' => \nhkey\arh\ActiveRecordHistoryBehavior::className(),
'manager' => '\nhkey\arh\managers\FileManager',
'class' => \yetopen\arh\ActiveRecordHistoryBehavior::className(),
'manager' => '\yetopen\arh\managers\FileManager',
'managerOptions' => [
'filename' => '/home/user/logs_app/MyClass.log',
],
Expand All @@ -116,15 +116,15 @@ or

#### Example 2

[DBManager](https://github.com/nhkey/yii2-activerecord-history/blob/master/docs/en/managers.md#dbmanager):
[DBManager](https://github.com/yetopen/yii2-activerecord-history/blob/master/docs/en/managers.md#dbmanager):

```php
class MyClass extends ActiveRecord {
public function behaviors(){
return [
'history' => [
'class' => \nhkey\arh\ActiveRecordHistoryBehavior::className(),
'manager' => '\nhkey\arh\managers\DBManager',
'class' => \yetopen\arh\ActiveRecordHistoryBehavior::className(),
'manager' => '\yetopen\arh\managers\DBManager',
'managerOptions' => [
'tableName' => 'MyLogTable',
],
Expand All @@ -135,7 +135,7 @@ or
```


[Back To Main page](https://github.com/nhkey/yii2-activerecord-history/blob/master/README.md)
[Back To Main page](https://github.com/yetopen/yii2-activerecord-history/blob/master/README.md)

## Controller ActiveRecordHistory
Provides some actions for common utilities, for example to display all the changes of a model you can call
Expand Down
12 changes: 6 additions & 6 deletions docs/en/usage-as-extend.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
There is old method for use this extension and not supported after version 1.1.0


To use this extension, simply change the parent class from \yii\db\ActiveRecord to \nhkey\arh\ActiveRecordHistory
To use this extension, simply change the parent class from \yii\db\ActiveRecord to \yetopen\arh\ActiveRecordHistory

For example:

Expand Down Expand Up @@ -33,12 +33,12 @@ If you want to optain the log records corresponding to all the changes of a mode

#### Example 1

[FileManager](https://github.com/nhkey/yii2-activerecord-history/blob/master/docs/en/managers#filemanager):
[FileManager](https://github.com/yetopen/yii2-activerecord-history/blob/master/docs/en/managers#filemanager):

```php
class MyClass extends \nhkey\arh\ActiveRecordHistory
class MyClass extends \yetopen\arh\ActiveRecordHistory
{
$_historyManager = '\nhkey\arh\managers\FileManager'
$_historyManager = '\yetopen\arh\managers\FileManager'
$_optionsHistoryManager = [
'filename' => '/home/user/MyClass.log',
];
Expand All @@ -48,10 +48,10 @@ If you want to optain the log records corresponding to all the changes of a mode

#### Example 2

[DBManager](https://github.com/nhkey/yii2-activerecord-history/blob/master/docs/en/managers#dbmanager):
[DBManager](https://github.com/yetopen/yii2-activerecord-history/blob/master/docs/en/managers#dbmanager):

```php
class MyClass extends \nhkey\arh\ActiveRecordHistory
class MyClass extends \yetopen\arh\ActiveRecordHistory
{
...
}
Expand Down
2 changes: 1 addition & 1 deletion migrations/m150122_115959_activerecordhistory_init.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

use yii\db\Migration;
use nhkey\arh\managers\DBManager;
use yetopen\arh\managers\DBManager;


/**
Expand Down
2 changes: 1 addition & 1 deletion migrations/m151013_131405_add_user_field.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

use yii\db\Migration;
use nhkey\arh\managers\DBManager;
use yetopen\arh\managers\DBManager;


/**
Expand Down
2 changes: 1 addition & 1 deletion migrations/m181116_174005_add_indexes.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

use yii\db\Migration;
use nhkey\arh\managers\DBManager;
use yetopen\arh\managers\DBManager;


/**
Expand Down
2 changes: 1 addition & 1 deletion migrations/m190619_174005_add_indexes.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

use yii\db\Migration;
use nhkey\arh\managers\DBManager;
use yetopen\arh\managers\DBManager;


/**
Expand Down
2 changes: 1 addition & 1 deletion migrations/m190625_174005_add_action_column.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

use yii\db\Migration;
use nhkey\arh\managers\DBManager;
use yetopen\arh\managers\DBManager;


/**
Expand Down
8 changes: 4 additions & 4 deletions src/ActiveRecordHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
* @author Mikhail Mikhalev
*/

namespace nhkey\arh;
namespace yetopen\arh;

use nhkey\arh\managers\BaseManager;
use yetopen\arh\managers\BaseManager;
use Yii;

/**
* Class ActiveRecordHistory
* @package nhkey\arh
* @package yetopen\arh
* @deprecated
*/
class ActiveRecordHistory extends \yii\db\ActiveRecord
Expand All @@ -20,7 +20,7 @@ class ActiveRecordHistory extends \yii\db\ActiveRecord
/**
* @var BaseManager
*/
protected $_historyManager = 'nhkey\arh\managers\DBManager';
protected $_historyManager = 'yetopen\arh\managers\DBManager';

/**
* @var array
Expand Down
6 changes: 3 additions & 3 deletions src/ActiveRecordHistoryBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* @author Mikhail Mikhalev
*/

namespace nhkey\arh;
namespace yetopen\arh;

use nhkey\arh\managers\BaseManager;
use yetopen\arh\managers\BaseManager;
use Yii;
use yii\base\InvalidArgumentException;
use yii\db\ActiveRecord;
Expand All @@ -24,7 +24,7 @@ class ActiveRecordHistoryBehavior extends Behavior
* @var BaseManager This is manager for save history in some storage
* Default value: DBManager.
*/
public $manager ='nhkey\arh\managers\DBManager';
public $manager ='yetopen\arh\managers\DBManager';

/**
* @var array This fields not to be saved in the history.
Expand Down
6 changes: 3 additions & 3 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
* Time: 12:59
*/

namespace nhkey\arh;
namespace yetopen\arh;

use nhkey\arh\widgets\ModelChangesButton;
use yetopen\arh\widgets\ModelChangesButton;
use yii\base\Module AS BaseModule;


class Module extends BaseModule
{
public $controllerNamespace = 'nhkey\arh\controllers';
public $controllerNamespace = 'yetopen\arh\controllers';

public $allowedPermissions = [];

Expand Down
2 changes: 1 addition & 1 deletion src/controllers/ActiveRecordHistoryController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace nhkey\arh\controllers;
namespace yetopen\arh\controllers;

use Yii;
use yii\data\ArrayDataProvider;
Expand Down
2 changes: 1 addition & 1 deletion src/managers/ActiveRecordHistoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @author Mikhail Mikhalev
*/

namespace nhkey\arh\managers;
namespace yetopen\arh\managers;

interface ActiveRecordHistoryInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/managers/BaseManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @author Mikhail Mikhalev
*/

namespace nhkey\arh\managers;
namespace yetopen\arh\managers;

use Yii;
use yii\base\ErrorException;
Expand Down
4 changes: 2 additions & 2 deletions src/managers/DBManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @author Mikhail Mikhalev
*/

namespace nhkey\arh\managers;
namespace yetopen\arh\managers;

use yii\db\Expression;
use const SORT_DESC;
Expand All @@ -17,7 +17,7 @@

/**
* Class DBManager for save history in DB
* @package nhkey\arh
* @package yetopen\arh
*/
class DBManager extends BaseManager
{
Expand Down
Loading