Skip to content

Commit

Permalink
Merge pull request #11 from vienthuong/1.3.1
Browse files Browse the repository at this point in the history
Release 1.3.1 - Bug fixed
  • Loading branch information
vienthuong authored Oct 4, 2021
2 parents d002908 + 2ac733f commit f1d80a4
Show file tree
Hide file tree
Showing 53 changed files with 415 additions and 733 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to `shopware-php-sdk` will be documented in this file.

Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

### 1.3.1
- [Hydrate Bug fixed](https://github.com/vienthuong/shopware-php-sdk/issues/10)
- Update Latest DAL Classes

### 1.3.0
- PHP 8 compatibility

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ composer require vin-sw/shopware-sdk
- Webhook authentication
- Webhook receiver

- If you're using Laravel 8, consider check this out [Laravel Shopware SDK Adapter](https://github.com/Shape-and-Shift/shopware-laravel-sdk)

## Usage

More in the examples folder, for integrating the sdk in an App, have a look at this [repository](https://github.com/vienthuong/AppExample)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A PHP SDK for Shopware 6 Platform",
"type": "library",
"license": "MIT",
"version": "1.3.0",
"version": "1.3.1",
"authors": [
{
"name": "vin",
Expand Down
1 change: 1 addition & 0 deletions src/Data/Entity/App/AppDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function getSchema() : Schema
new Property('templates', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('cascade_delete', 1), ]), ['entity' => 'app_template', 'referenceField' => 'appId', 'localField' => 'id', 'relation' => 'one_to_many', ]),
new Property('webhooks', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('cascade_delete', 1), ]), ['entity' => 'webhook', 'referenceField' => 'appId', 'localField' => 'id', 'relation' => 'one_to_many', ]),
new Property('paymentMethods', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('set_null_on_delete', 1), ]), ['entity' => 'app_payment_method', 'referenceField' => 'appId', 'localField' => 'id', 'relation' => 'one_to_many', ]),
new Property('cmsBlocks', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('cascade_delete', 1), ]), ['entity' => 'app_cms_block', 'referenceField' => 'appId', 'localField' => 'id', 'relation' => 'one_to_many', ]),
new Property('createdAt', 'date', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('required', 1), ]), []),
new Property('updatedAt', 'date', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), ]), []),
new Property('translated', 'json_object', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('computed', 1), new Flag('runtime', 1), ]), []),
Expand Down
3 changes: 3 additions & 0 deletions src/Data/Entity/App/AppEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Vin\ShopwareSdk\Data\Entity\AppTemplate\AppTemplateCollection;
use Vin\ShopwareSdk\Data\Entity\Webhook\WebhookCollection;
use Vin\ShopwareSdk\Data\Entity\AppPaymentMethod\AppPaymentMethodCollection;
use Vin\ShopwareSdk\Data\Entity\AppCmsBlock\AppCmsBlockCollection;
use Vin\ShopwareSdk\Data\Entity\Entity;

/**
Expand Down Expand Up @@ -73,4 +74,6 @@ class AppEntity extends Entity
public ?WebhookCollection $webhooks = null;

public ?AppPaymentMethodCollection $paymentMethods = null;

public ?AppCmsBlockCollection $cmsBlocks = null;
}
25 changes: 25 additions & 0 deletions src/Data/Entity/AppCmsBlock/AppCmsBlockCollection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php declare(strict_types=1);
namespace Vin\ShopwareSdk\Data\Entity\AppCmsBlock;

use Vin\ShopwareSdk\Data\Entity\EntityCollection;

/**
* Shopware Collection Mapping Class
*
* This class is generated dynamically following SW entities schema
*
* @method void add(AppCmsBlockEntity $entity)
* @method void set(AppCmsBlockEntity $entity)
* @method AppCmsBlockEntity[] getIterator()
* @method AppCmsBlockEntity[] getElements()
* @method AppCmsBlockEntity|null get(string $key)
* @method AppCmsBlockEntity|null first()
* @method AppCmsBlockEntity|null last()
*/
class AppCmsBlockCollection extends EntityCollection
{
public function getExpectedClass() : string
{
return AppCmsBlockEntity::class;
}
}
52 changes: 52 additions & 0 deletions src/Data/Entity/AppCmsBlock/AppCmsBlockDefinition.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php declare(strict_types=1);
namespace Vin\ShopwareSdk\Data\Entity\AppCmsBlock;

use Vin\ShopwareSdk\Data\Entity\EntityDefinition;
use Vin\ShopwareSdk\Data\Schema\PropertyCollection;
use Vin\ShopwareSdk\Data\Schema\FlagCollection;
use Vin\ShopwareSdk\Data\Schema\Property;
use Vin\ShopwareSdk\Data\Schema\Flag;
use Vin\ShopwareSdk\Data\Schema\Schema;

/**
* Shopware Definition Mapping Class
*
* This class is generated dynamically following SW entities schema
*/
class AppCmsBlockDefinition implements EntityDefinition
{
public const ENTITY_NAME = 'app_cms_block';

public function getEntityName() : string
{
return self::ENTITY_NAME;
}

public function getEntityClass() : string
{
return AppCmsBlockEntity::class;
}

public function getEntityCollection() : string
{
return AppCmsBlockCollection::class;
}

public function getSchema() : Schema
{
return new Schema('app_cms_block', new PropertyCollection([
new Property('id', 'uuid', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('primary_key', 1), new Flag('required', 1), ]), []),
new Property('name', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('required', 1), ]), []),
new Property('block', 'json_object', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('required', 1), ]), []),
new Property('template', 'text', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('required', 1), new Flag('allow_html', 1), ]), []),
new Property('styles', 'text', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('required', 1), ]), []),
new Property('label', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('required', 1), new Flag('translatable', 1), ]), []),
new Property('translations', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('cascade_delete', 1), new Flag('required', 1), ]), ['entity' => 'app_cms_block_translation', 'referenceField' => 'appCmsBlockId', 'localField' => 'id', 'relation' => 'one_to_many', ]),
new Property('appId', 'uuid', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('required', 1), ]), []),
new Property('app', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), ]), ['entity' => 'app', 'referenceField' => 'id', 'localField' => 'appId', 'relation' => 'many_to_one', ]),
new Property('createdAt', 'date', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('required', 1), ]), []),
new Property('updatedAt', 'date', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), ]), []),
new Property('translated', 'json_object', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('computed', 1), new Flag('runtime', 1), ]), []),
]));
}
}
30 changes: 30 additions & 0 deletions src/Data/Entity/AppCmsBlock/AppCmsBlockEntity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php declare(strict_types=1);
namespace Vin\ShopwareSdk\Data\Entity\AppCmsBlock;

use Vin\ShopwareSdk\Data\Entity\AppCmsBlockTranslation\AppCmsBlockTranslationCollection;
use Vin\ShopwareSdk\Data\Entity\App\AppEntity;
use Vin\ShopwareSdk\Data\Entity\Entity;

/**
* Shopware Entity Mapping Class
*
* This class is generated dynamically following SW entities schema
*/
class AppCmsBlockEntity extends Entity
{
public ?string $name = null;

public ?array $block = null;

public ?string $template = null;

public ?string $styles = null;

public ?string $label = null;

public ?AppCmsBlockTranslationCollection $translations = null;

public ?string $appId = null;

public ?AppEntity $app = null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php declare(strict_types=1);
namespace Vin\ShopwareSdk\Data\Entity\AppCmsBlockTranslation;

use Vin\ShopwareSdk\Data\Entity\EntityCollection;

/**
* Shopware Collection Mapping Class
*
* This class is generated dynamically following SW entities schema
*
* @method void add(AppCmsBlockTranslationEntity $entity)
* @method void set(AppCmsBlockTranslationEntity $entity)
* @method AppCmsBlockTranslationEntity[] getIterator()
* @method AppCmsBlockTranslationEntity[] getElements()
* @method AppCmsBlockTranslationEntity|null get(string $key)
* @method AppCmsBlockTranslationEntity|null first()
* @method AppCmsBlockTranslationEntity|null last()
*/
class AppCmsBlockTranslationCollection extends EntityCollection
{
public function getExpectedClass() : string
{
return AppCmsBlockTranslationEntity::class;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php declare(strict_types=1);
namespace Vin\ShopwareSdk\Data\Entity\SasBlogAuthorTranslation;
namespace Vin\ShopwareSdk\Data\Entity\AppCmsBlockTranslation;

use Vin\ShopwareSdk\Data\Entity\EntityDefinition;
use Vin\ShopwareSdk\Data\Schema\PropertyCollection;
Expand All @@ -13,9 +13,9 @@
*
* This class is generated dynamically following SW entities schema
*/
class SasBlogAuthorTranslationDefinition implements EntityDefinition
class AppCmsBlockTranslationDefinition implements EntityDefinition
{
public const ENTITY_NAME = 'sas_blog_author_translation';
public const ENTITY_NAME = 'app_cms_block_translation';

public function getEntityName() : string
{
Expand All @@ -24,24 +24,23 @@ public function getEntityName() : string

public function getEntityClass() : string
{
return SasBlogAuthorTranslationEntity::class;
return AppCmsBlockTranslationEntity::class;
}

public function getEntityCollection() : string
{
return SasBlogAuthorTranslationCollection::class;
return AppCmsBlockTranslationCollection::class;
}

public function getSchema() : Schema
{
return new Schema('sas_blog_author_translation', new PropertyCollection([
new Property('description', 'text', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), ]), []),
new Property('customFields', 'json_object', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), ]), []),
return new Schema('app_cms_block_translation', new PropertyCollection([
new Property('label', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('required', 1), ]), []),
new Property('createdAt', 'date', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('required', 1), ]), []),
new Property('updatedAt', 'date', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), ]), []),
new Property('sasBlogAuthorId', 'uuid', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('primary_key', 1), new Flag('required', 1), ]), []),
new Property('appCmsBlockId', 'uuid', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('primary_key', 1), new Flag('required', 1), ]), []),
new Property('languageId', 'uuid', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('primary_key', 1), new Flag('required', 1), ]), []),
new Property('sasBlogAuthor', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), ]), ['entity' => 'sas_blog_author', 'referenceField' => 'id', 'localField' => 'sasBlogAuthorId', 'relation' => 'many_to_one', ]),
new Property('appCmsBlock', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), ]), ['entity' => 'app_cms_block', 'referenceField' => 'id', 'localField' => 'appCmsBlockId', 'relation' => 'many_to_one', ]),
new Property('language', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), ]), ['entity' => 'language', 'referenceField' => 'id', 'localField' => 'languageId', 'relation' => 'many_to_one', ]),
]));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php declare(strict_types=1);
namespace Vin\ShopwareSdk\Data\Entity\SasBlogAuthorTranslation;
namespace Vin\ShopwareSdk\Data\Entity\AppCmsBlockTranslation;

use Vin\ShopwareSdk\Data\Entity\SasBlogAuthor\SasBlogAuthorEntity;
use Vin\ShopwareSdk\Data\Entity\AppCmsBlock\AppCmsBlockEntity;
use Vin\ShopwareSdk\Data\Entity\Language\LanguageEntity;
use Vin\ShopwareSdk\Data\Entity\Entity;

Expand All @@ -10,15 +10,15 @@
*
* This class is generated dynamically following SW entities schema
*/
class SasBlogAuthorTranslationEntity extends Entity
class AppCmsBlockTranslationEntity extends Entity
{
public ?string $description = null;
public ?string $label = null;

public ?string $sasBlogAuthorId = null;
public ?string $appCmsBlockId = null;

public ?string $languageId = null;

public ?SasBlogAuthorEntity $sasBlogAuthor = null;
public ?AppCmsBlockEntity $appCmsBlock = null;

public ?LanguageEntity $language = null;
}
2 changes: 1 addition & 1 deletion src/Data/Entity/CmsPage/CmsPageDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function getSchema() : Schema
return new Schema('cms_page', new PropertyCollection([
new Property('id', 'uuid', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('primary_key', 1), new Flag('required', 1), ]), []),
new Property('versionId', 'uuid', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('primary_key', 1), new Flag('required', 1), ]), []),
new Property('name', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('required', 1), new Flag('translatable', 1), ]), []),
new Property('name', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('translatable', 1), ]), []),
new Property('type', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('required', 1), ]), []),
new Property('entity', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), ]), []),
new Property('config', 'json_object', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), ]), ['properties' => json_decode('{"backgroundColor":{"type":"string","flags":{"read_protected":[["Shopware\\Core\\Framework\\Api\\Context\\AdminApiSource","Shopware\\Core\\Framework\\Api\\Context\\SalesChannelApiSource"]]}}}', true), ]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function getEntityCollection() : string
public function getSchema() : Schema
{
return new Schema('cms_page_translation', new PropertyCollection([
new Property('name', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('required', 1), ]), []),
new Property('name', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), ]), []),
new Property('customFields', 'json_object', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), ]), []),
new Property('createdAt', 'date', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('required', 1), ]), []),
new Property('updatedAt', 'date', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), ]), []),
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Entity/Customer/CustomerDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getSchema() : Schema
new Property('defaultShippingAddressId', 'uuid', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('required', 1), ]), []),
new Property('autoIncrement', 'int', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('write_protected', [[]]), ]), []),
new Property('customerNumber', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('required', 1), new Flag('search_ranking', 500), ]), []),
new Property('salutationId', 'uuid', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('required', 1), ]), []),
new Property('salutationId', 'uuid', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), ]), []),
new Property('firstName', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('required', 1), new Flag('search_ranking', 250), ]), []),
new Property('lastName', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('required', 1), new Flag('search_ranking', 500), ]), []),
new Property('company', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('search_ranking', 500), ]), []),
Expand Down
Loading

0 comments on commit f1d80a4

Please sign in to comment.