Skip to content

Commit

Permalink
media entites sw6.6 aware
Browse files Browse the repository at this point in the history
  • Loading branch information
ededagic committed Jul 6, 2024
1 parent 471f0a0 commit cfdd539
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "vin-sw/shopware-sdk",
"name": "webv/shopware-sdk",
"description": "A PHP SDK for Shopware 6 Platform",
"type": "library",
"license": "MIT",
"version": "2.0.0",
"version": "2.0.1",
"authors": [
{
"name": "vin",
"email": "[email protected]"
"name": "webv",
"email": "[email protected]"
}
],
"minimum-stability": "stable",
Expand Down
3 changes: 3 additions & 0 deletions src/Data/Entity/Media/MediaDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ public function getSchema() : Schema
new Property('mediaTypeRaw', 'blob', new FlagCollection([new Flag('write_protected', [['system']]), ]), []),
new Property('metaData', 'json_object', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('write_protected', [['system']]), ]), []),
new Property('mediaType', 'json_object', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('write_protected', [[]]), new Flag('runtime', 1), ]), []),
new Property('config', 'json_object', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('runtime', ['path', 'updatedAt']), ]), []),
new Property('alt', 'text', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('search_ranking', 250), new Flag('translatable', 1), ]), []),
new Property('title', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('search_ranking', 500), new Flag('translatable', 1), ]), []),
new Property('url', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('runtime', 1), ]), []),
new Property('path', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), ]), []),
new Property('hasFile', 'boolean', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('runtime', 1), ]), []),
new Property('private', 'boolean', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), ]), []),
new Property('customFields', 'json_object', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('translatable', 1), ]), []),
Expand Down Expand Up @@ -76,6 +78,7 @@ public function getSchema() : Schema
new Property('cmsPages', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('restrict_delete', 1), ]), ['entity' => 'cms_page', 'referenceField' => 'previewMediaId', 'localField' => 'id', 'relation' => 'one_to_many', ]),
new Property('documents', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('restrict_delete', 1), ]), ['entity' => 'document', 'referenceField' => 'documentMediaFileId', 'localField' => 'id', 'relation' => 'one_to_many', ]),
new Property('appPaymentMethods', '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' => 'originalMediaId', 'localField' => 'id', 'relation' => 'one_to_many', ]),
new Property('appShippingMethods', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('set_null_on_delete', 1), ]), ['entity' => 'app_shipping_method', 'referenceField' => 'originalMediaId', '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('themes', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), new Flag('extension', 1), ]), ['entity' => 'theme', 'referenceField' => 'previewMediaId', 'localField' => 'id', 'relation' => 'one_to_many', ]),
Expand Down
13 changes: 9 additions & 4 deletions src/Data/Entity/Media/MediaEntity.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php declare(strict_types=1);
namespace Vin\ShopwareSdk\Data\Entity\Media;

use Vin\ShopwareSdk\Data\Entity\EntityCollection;
use Vin\ShopwareSdk\Data\Entity\MediaTranslation\MediaTranslationCollection;
use Vin\ShopwareSdk\Data\Entity\Tag\TagCollection;
use Vin\ShopwareSdk\Data\Entity\MediaThumbnail\MediaThumbnailCollection;
Expand Down Expand Up @@ -38,18 +39,24 @@ class MediaEntity extends Entity

public ?string $mediaFolderId = null;

public ?array $config = null;

public ?string $path = null;

public ?string $mimeType = null;

public ?string $fileExtension = null;

public ?\DateTimeInterface$uploadedAt = null;
public ?\DateTimeInterface $uploadedAt = null;

public ?string $fileName = null;

public ?int $fileSize = null;

public ?string $mediaTypeRaw = null;

public ?string $metaDataRaw = null;

public ?array $metaData = null;

public ?array $mediaType = null;
Expand Down Expand Up @@ -112,7 +119,5 @@ class MediaEntity extends Entity

public ?AppPaymentMethodCollection $appPaymentMethods = null;

public ?ThemeCollection $themes = null;

public ?ThemeCollection $themeMedia = null;
public ?EntityCollection $appShippingMethods = null;
}
3 changes: 1 addition & 2 deletions src/Data/Entity/MediaThumbnail/MediaThumbnailDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ public function getSchema() : Schema
new Property('width', 'int', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('required', 1), new Flag('write_protected', [['system']]), ]), []),
new Property('height', 'int', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('required', 1), new Flag('write_protected', [['system']]), ]), []),
new Property('url', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]), new Flag('runtime', 1), ]), []),
new Property('path', 'string', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource', 'Shopware\Core\Framework\Api\Context\SalesChannelApiSource']]) ]), []),
new Property('media', 'association', new FlagCollection([new Flag('read_protected', [['Shopware\Core\Framework\Api\Context\AdminApiSource']]), ]), ['entity' => 'media', 'referenceField' => 'id', 'localField' => 'mediaId', 'relation' => 'many_to_one', ]),
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']]), ]), []),
]));
}
}
2 changes: 2 additions & 0 deletions src/Data/Entity/MediaThumbnail/MediaThumbnailEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class MediaThumbnailEntity extends Entity

public ?int $height = null;

public ?string $path = null;

public ?string $url = null;

public ?MediaEntity $media = null;
Expand Down

0 comments on commit cfdd539

Please sign in to comment.