44
55namespace Setono \SyliusSEOPlugin \DataMapper \OnlineStore ;
66
7- use Setono \ SyliusSEOPlugin \ StructuredData \ Thing \ Intangible \ StructuredValue \ ContactPoint ;
8- use Setono \ SyliusSEOPlugin \ StructuredData \ Thing \ Organization \ OnlineBusiness \ OnlineStore ;
7+ use Spatie \ SchemaOrg \ OnlineStore ;
8+ use Spatie \ SchemaOrg \ Schema ;
99use Sylius \Component \Core \Model \ChannelInterface ;
1010use Symfony \Component \Routing \Generator \UrlGeneratorInterface ;
1111
@@ -17,24 +17,28 @@ public function __construct(private readonly UrlGeneratorInterface $urlGenerator
1717
1818 public function map (ChannelInterface $ channel , OnlineStore $ onlineStore ): void
1919 {
20- $ onlineStore ->name = $ channel ->getName ();
21- $ onlineStore ->vatID = $ channel ->getShopBillingData ()?->getTaxId();
22- $ onlineStore ->contactPoint = new ContactPoint ([
23- 'email ' => $ channel ->getContactEmail (),
24- 'telephone ' => $ channel ->getContactPhoneNumber (),
25- ]);
26- $ onlineStore ->address = new ContactPoint \PostalAddress ([
27- 'streetAddress ' => $ channel ->getShopBillingData ()?->getStreet(),
28- 'addressLocality ' => $ channel ->getShopBillingData ()?->getCity(),
29- 'addressCountry ' => $ channel ->getShopBillingData ()?->getCountryCode(),
30- 'postalCode ' => $ channel ->getShopBillingData ()?->getPostcode(),
31- ]);
20+ $ onlineStore
21+ ->name ((string ) $ channel ->getName ())
22+ ->vatID ((string ) $ channel ->getShopBillingData ()?->getTaxId())
23+ ->contactPoint (
24+ Schema::contactPoint ()
25+ ->email ((string ) $ channel ->getContactEmail ())
26+ ->telephone ((string ) $ channel ->getContactPhoneNumber ()),
27+ )
28+ ->address (
29+ Schema::postalAddress ()
30+ ->streetAddress ((string ) $ channel ->getShopBillingData ()?->getStreet())
31+ ->addressLocality ((string ) $ channel ->getShopBillingData ()?->getCity())
32+ ->addressCountry ((string ) $ channel ->getShopBillingData ()?->getCountryCode())
33+ ->postalCode ((string ) $ channel ->getShopBillingData ()?->getPostcode()),
34+ )
35+ ;
3236
3337 $ hostname = $ channel ->getHostname ();
3438 if (null === $ hostname ) {
35- $ onlineStore ->url = $ this ->urlGenerator ->generate (name: 'sylius_shop_homepage ' , referenceType: UrlGeneratorInterface::ABSOLUTE_URL );
39+ $ onlineStore ->url ( $ this ->urlGenerator ->generate (name: 'sylius_shop_homepage ' , referenceType: UrlGeneratorInterface::ABSOLUTE_URL ) );
3640 } else {
37- $ onlineStore ->url = sprintf ('https://%s ' , $ hostname );
41+ $ onlineStore ->url ( sprintf ('https://%s ' , $ hostname) );
3842 }
3943 }
4044}
0 commit comments