Skip to content

Commit

Permalink
remove deprecated methods #1505
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Sep 19, 2017
1 parent 67aba6a commit 5e83ac0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. This projec

### Changed

- [#1505](https://github.com/luyadev/luya/issues/1505) Minor API Breaks and removed deprecated methods.
- [#1341](https://github.com/luyadev/luya/issues/1341) Changed signature of `changePassword($newPassword)` in `luya\admin\aws\ChangePasswordInterface`.

### Added
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/ngrest-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ We have also added a soft delete trait {{\luya\admin\traits\SoftDeleteTrait}} wh
use luya\admin\traits\SoftDeleteTrait;
```

By default, soft delete trait will use the field `is_deleted` to find and delete data records, you can configure the field by overriding the `FieldStateDescriber` method as followed:
By default, soft delete trait will use the field `is_deleted` to find and delete data records, you can configure the field by overriding the {{luya\admin\traits\SoftDeleteTrait::fieldStateDescriber()}} method as followed:

```php
public static function FieldStateDescriber()
public static function fieldStateDescriber()
{
return [
'is_deleted' => [1, 0], // on delete sets `is_deleted = 1`; on find add where `where(['is_deleted' => 0]);`.
Expand Down
9 changes: 0 additions & 9 deletions modules/admin/src/storage/ItemAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ public function setItemArray(array $item)
{
$this->_itemArray = $item;
}

/**
* @deprecated Remove.
* @return unknown
*/
public function getItemArray()
{
return $this->_itemArray;
}

/**
* Method to construct/build the item from Iterator or Query class.
Expand Down
12 changes: 4 additions & 8 deletions modules/admin/src/traits/SoftDeleteTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Trait to enable Soft Deletion for NgRest and ActiveRecord models.
*
* To override a match your custom field desribers (describers which is deleted and find state) you
* can override the static `FieldStateDescriber()` method as described in the description of the method.
* can override the static `fieldStateDescriber()` method as described in the description of the method.
*
* @author Basil Suter <basil@nadar.io>
*/
Expand All @@ -24,19 +24,15 @@ trait SoftDeleteTrait
* ];
* ```
*
* @todo rename to fieldStateDescriber!
* @return array Returns an array with a key which desribes what field should be updated on delete and observed on find,
* the value for the corresponding field can be an array or a string/numeric
*
* - array: The first value is the value for the delete command, the second for the find where
* - string/nummeric: The value will be inverted with "!" opposite operator, this can lead into problems
*
* if you want to override the default implemenation to match your custom models you should always use the former type of state description.
*
* @todo rename to fieldStateDescriber
* @deprecated remove in 1.0.0 replace with fieldStateDescriber
*/
public static function FieldStateDescriber()
public static function fieldStateDescriber()
{
return [
'is_deleted' => [true, false]
Expand All @@ -52,7 +48,7 @@ public static function internalAndWhere()
{
$query = [];

foreach (static::FieldStateDescriber() as $field => $value) {
foreach (static::fieldStateDescriber() as $field => $value) {
$query[$field] = (is_array($value)) ? $value[1] : !$value;
}

Expand Down Expand Up @@ -104,7 +100,7 @@ public function delete()
private static function internalUpdateValues()
{
$update = [];
foreach (static::FieldStateDescriber() as $field => $value) {
foreach (static::fieldStateDescriber() as $field => $value) {
$update[$field] = (is_array($value)) ? $value[0] : $value;
}
return $update;
Expand Down

0 comments on commit 5e83ac0

Please sign in to comment.