Skip to content

Commit

Permalink
Closes BR-43
Browse files Browse the repository at this point in the history
fix values model for chained_list type

fix namespaces and chained_list field type value model factory
  • Loading branch information
noweasily committed May 18, 2022
1 parent 04e0140 commit 92be057
Show file tree
Hide file tree
Showing 20 changed files with 32 additions and 47 deletions.
8 changes: 4 additions & 4 deletions examples/chained_list_custom_field_actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

/** @since Release Spring 2022 */

use AmoCRM\AmoCRM\Models\CustomFields\ChainedListCustomFieldModel;
use AmoCRM\AmoCRM\Models\CustomFields\ChainedLists;
use AmoCRM\AmoCRM\Models\CustomFieldsValues\ChainedListCustomFieldValuesModel;
use AmoCRM\AmoCRM\Models\CustomFieldsValues\ValueCollections\ChainedListCustomFieldValueCollection;
use AmoCRM\Models\CustomFields\ChainedListCustomFieldModel;
use AmoCRM\Models\CustomFields\ChainedLists;
use AmoCRM\Models\CustomFieldsValues\ChainedListCustomFieldValuesModel;
use AmoCRM\Models\CustomFieldsValues\ValueCollections\ChainedListCustomFieldValueCollection;
use AmoCRM\Client\AmoCRMApiClient;
use AmoCRM\Collections\CustomFieldsValuesCollection;
use AmoCRM\Exceptions\AmoCRMApiException;
Expand Down
2 changes: 1 addition & 1 deletion examples/currencies_actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/** @since Release Spring 2022 */

use AmoCRM\AmoCRM\Filters\CurrenciesFilter;
use AmoCRM\Filters\CurrenciesFilter;
use AmoCRM\Client\AmoCRMApiClient;
use AmoCRM\Exceptions\AmoCRMApiException;
use League\OAuth2\Client\Token\AccessTokenInterface;
Expand Down
4 changes: 2 additions & 2 deletions examples/monetary_custom_field_actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/** @since Release Spring 2022 */

use AmoCRM\AmoCRM\Models\CustomFields\MonetaryCustomFieldModel;
use AmoCRM\Models\CustomFields\MonetaryCustomFieldModel;
use AmoCRM\Client\AmoCRMApiClient;
use AmoCRM\Exceptions\AmoCRMApiException;
use AmoCRM\Filters\LeadsFilter;
Expand Down Expand Up @@ -105,7 +105,7 @@ function (AccessTokenInterface $accessToken, string $baseDomain) {
$monetaryValuesModel = new \AmoCRM\Models\CustomFieldsValues\MonetaryCustomFieldValuesModel();
$monetaryValuesModel->setFieldId($monetaryCf->getId());
$monetaryValuesModel->setValues(
(new \AmoCRM\AmoCRM\Models\CustomFieldsValues\ValueCollections\MonetaryCustomFieldValueCollection())->add(
(new \AmoCRM\Models\CustomFieldsValues\ValueCollections\MonetaryCustomFieldValueCollection())->add(
(new \AmoCRM\Models\CustomFieldsValues\ValueModels\MonetaryCustomFieldValueModel())->setValue(100)
)
);
Expand Down
2 changes: 1 addition & 1 deletion src/AmoCRM/Client/AmoCRMApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace AmoCRM\Client;

use AmoCRM\AmoCRM\EntitiesServices\Currencies;
use AmoCRM\EntitiesServices\Currencies;
use AmoCRM\EntitiesServices\Account;
use AmoCRM\EntitiesServices\Calls;
use AmoCRM\EntitiesServices\CatalogElements;
Expand Down
5 changes: 2 additions & 3 deletions src/AmoCRM/Collections/CurrenciesCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

declare(strict_types=1);

namespace AmoCRM\AmoCRM\Collections;
namespace AmoCRM\Collections;

use AmoCRM\AmoCRM\Models\CurrencyModel;
use AmoCRM\Collections\BaseApiCollection;
use AmoCRM\Models\CurrencyModel;
use AmoCRM\Collections\Interfaces\HasPagesInterface;
use AmoCRM\Collections\Traits\PagesTrait;

Expand Down
9 changes: 4 additions & 5 deletions src/AmoCRM/EntitiesServices/Currencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

declare(strict_types=1);

namespace AmoCRM\AmoCRM\EntitiesServices;
namespace AmoCRM\EntitiesServices;

use AmoCRM\AmoCRM\Collections\CurrenciesCollection;
use AmoCRM\AmoCRM\Filters\CurrenciesFilter;
use AmoCRM\AmoCRM\Models\CurrencyModel;
use AmoCRM\Collections\CurrenciesCollection;
use AmoCRM\Filters\CurrenciesFilter;
use AmoCRM\Models\CurrencyModel;
use AmoCRM\Client\AmoCRMApiClient;
use AmoCRM\Client\AmoCRMApiRequest;
use AmoCRM\Collections\BaseApiCollection;
use AmoCRM\EntitiesServices\BaseEntity;
use AmoCRM\EntitiesServices\Interfaces\HasPageMethodsInterface;
use AmoCRM\EntitiesServices\Traits\PageMethodsTrait;
use AmoCRM\Exceptions\NotAvailableForActionException;
Expand Down
4 changes: 1 addition & 3 deletions src/AmoCRM/Filters/CurrenciesFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

declare(strict_types=1);

namespace AmoCRM\AmoCRM\Filters;

use AmoCRM\Filters\PagesFilter;
namespace AmoCRM\Filters;

/**
* @since Release Spring 2022
Expand Down
4 changes: 1 addition & 3 deletions src/AmoCRM/Models/CurrencyModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

declare(strict_types=1);

namespace AmoCRM\AmoCRM\Models;

use AmoCRM\Models\BaseApiModel;
namespace AmoCRM\Models;

/**
* @since Release Spring 2022
Expand Down
2 changes: 1 addition & 1 deletion src/AmoCRM/Models/CustomFields/ChainedList.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace AmoCRM\AmoCRM\Models\CustomFields;
namespace AmoCRM\Models\CustomFields;

use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

declare(strict_types=1);

namespace AmoCRM\AmoCRM\Models\CustomFields;

use AmoCRM\Models\CustomFields\CustomFieldModel;
namespace AmoCRM\Models\CustomFields;

/**
* Модель поля вложенных списков
Expand Down
2 changes: 1 addition & 1 deletion src/AmoCRM/Models/CustomFields/ChainedLists.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace AmoCRM\AmoCRM\Models\CustomFields;
namespace AmoCRM\Models\CustomFields;

use Illuminate\Support\Collection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace AmoCRM\Models\CustomFields\Factories;

use AmoCRM\AmoCRM\Models\CustomFields\ChainedListCustomFieldModel;
use AmoCRM\AmoCRM\Models\CustomFields\MonetaryCustomFieldModel;
use AmoCRM\Models\CustomFields\ChainedListCustomFieldModel;
use AmoCRM\Models\CustomFields\MonetaryCustomFieldModel;
use AmoCRM\Models\CustomFields\OrgLegalNameCustomFieldModel;
use AmoCRM\Models\CustomFields\TrackingDataCustomFieldModel;
use AmoCRM\Models\CustomFields\BirthdayCustomFieldModel;
Expand Down
4 changes: 1 addition & 3 deletions src/AmoCRM/Models/CustomFields/MonetaryCustomFieldModel.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php

namespace AmoCRM\AmoCRM\Models\CustomFields;

use AmoCRM\Models\CustomFields\CustomFieldModel;
namespace AmoCRM\Models\CustomFields;

/**
* @since Release Spring 2022
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

declare(strict_types=1);

namespace AmoCRM\AmoCRM\Models\CustomFieldsValues;
namespace AmoCRM\Models\CustomFieldsValues;

use AmoCRM\Models\CustomFields\CustomFieldModel;
use AmoCRM\Models\CustomFieldsValues\BaseCustomFieldValuesModel;

/**
* @since Release Spring 2022
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace AmoCRM\Models\CustomFieldsValues\Factories;

use AmoCRM\AmoCRM\Models\CustomFieldsValues\ValueCollections\ChainedListCustomFieldValueCollection;
use AmoCRM\AmoCRM\Models\CustomFieldsValues\ValueCollections\MonetaryCustomFieldValueCollection;
use AmoCRM\Models\CustomFieldsValues\ValueCollections\ChainedListCustomFieldValueCollection;
use AmoCRM\Models\CustomFieldsValues\ValueCollections\MonetaryCustomFieldValueCollection;
use AmoCRM\Models\CustomFieldsValues\ValueCollections\LinkedEntityCustomFieldValueCollection;
use AmoCRM\Models\CustomFieldsValues\ValueCollections\TrackingDataCustomFieldValueCollection;
use AmoCRM\Helpers\CustomFieldHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace AmoCRM\Models\CustomFieldsValues\Factories;

use AmoCRM\AmoCRM\Models\CustomFieldsValues\ValueModels\ChainedListCustomFieldValueModel;
use AmoCRM\Models\CustomFieldsValues\ValueModels\ChainedListCustomFieldValueModel;
use AmoCRM\Models\CustomFieldsValues\ValueModels\LinkedEntityCustomFieldValueModel;
use AmoCRM\Models\CustomFieldsValues\ValueModels\MonetaryCustomFieldValueModel;
use AmoCRM\Models\CustomFieldsValues\ValueModels\TrackingDataCustomFieldValueModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AmoCRM\Models\CustomFieldsValues\Factories;

use AmoCRM\Models\CustomFieldsValues\ChainedListCustomFieldValuesModel;
use AmoCRM\Models\CustomFieldsValues\MonetaryCustomFieldValuesModel;
use AmoCRM\Models\CustomFieldsValues\TrackingDataCustomFieldValuesModel;
use AmoCRM\Models\CustomFields\CustomFieldModel;
Expand Down Expand Up @@ -114,7 +115,7 @@ public static function createModel(array $field): BaseCustomFieldValuesModel
$model = new MonetaryCustomFieldValuesModel();
break;
case CustomFieldModel::TYPE_CHAINED_LIST:
$model = new MonetaryCustomFieldValuesModel();
$model = new ChainedListCustomFieldValuesModel();
break;
default:
trigger_error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

declare(strict_types=1);

namespace AmoCRM\AmoCRM\Models\CustomFieldsValues\ValueCollections;
namespace AmoCRM\Models\CustomFieldsValues\ValueCollections;

use AmoCRM\AmoCRM\Models\CustomFieldsValues\ValueModels\ChainedListCustomFieldValueModel;
use AmoCRM\Models\CustomFieldsValues\ValueModels\ChainedListCustomFieldValueModel;
use AmoCRM\Collections\BaseApiCollection;
use AmoCRM\Exceptions\InvalidArgumentException;
use AmoCRM\Models\CustomFieldsValues\ValueCollections\BaseCustomFieldValueCollection;

use function array_map;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php

namespace AmoCRM\AmoCRM\Models\CustomFieldsValues\ValueCollections;

use AmoCRM\Models\CustomFieldsValues\ValueCollections\BaseCustomFieldValueCollection;
namespace AmoCRM\Models\CustomFieldsValues\ValueCollections;

/**
* @since Release Spring 2022
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

declare(strict_types=1);

namespace AmoCRM\AmoCRM\Models\CustomFieldsValues\ValueModels;

use AmoCRM\Models\CustomFieldsValues\ValueModels\BaseCustomFieldValueModel;
namespace AmoCRM\Models\CustomFieldsValues\ValueModels;

/**
* @since Release Spring 2022
Expand Down

0 comments on commit 92be057

Please sign in to comment.