Skip to content

Commit

Permalink
Merge branch '1.0'
Browse files Browse the repository at this point in the history
* 1.0:
  [Documentation] Minor description fix
  Change channel assignment example on payment method
  fix form extension link
  [Translations] Updated translations from Crowdin
  Narrow typehints for TranslationTrait::getTranslation() calls
  Narrow typehints for Core's CustomerInterface
  • Loading branch information
pamil committed Oct 26, 2017
2 parents 8e33ffd + 245d4fe commit 1a8186f
Show file tree
Hide file tree
Showing 28 changed files with 248 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/book/orders/payments.rst
Expand Up @@ -90,11 +90,11 @@ As usually, use a factory to create a new PaymentMethod and give it a unique cod
$this->container->get('sylius.repository.payment_method')->add($paymentMethod);
In order to have your new payment method available in the checkout remember to **add it to your desired channels**:
In order to have your new payment method available in the checkout remember to **add your desired channel to the payment method**:

.. code-block:: php
$channel->addPaymentMethod($paymentMethod);
$paymentMethod->addChannel($channel)
Payment Gateway configuration
-----------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/customization/form.rst
Expand Up @@ -121,7 +121,7 @@ Need more information?

.. warning::

Some of the forms already have extensions in Sylius. Learn more about Extensions `here <http://symfony.com/doc/current/bundles/extension.html>`_.
Some of the forms already have extensions in Sylius. Learn more about Extensions `here <http://symfony.com/doc/current/form/create_form_type_extension.html>`_.

For instance the ``ProductVariant`` admin form is defined under ``Sylius/Bundle/ProductBundle/Form/Type/ProductVariantType.php`` and later extended in
``Sylius/Bundle/CoreBundle/Form/Extension/ProductVariantTypeExtension.php``. If you again extend the base type form like this:
Expand Down
Expand Up @@ -7,3 +7,5 @@ sylius:
completed: 'Η πληρωμή ολοκληρώθηκε.'
failed: 'Η πληρωμή απέτυχε.'
processing: 'Η πληρωμή σας είναι σε επεξεργασία.'
refunded: 'Επιτυχής επιστροφή πληρωμής.'
unknown: 'Υπήρξε ένα άγνωστο πρόβλημα με την πληρωμή.'
Expand Up @@ -5,3 +5,4 @@ sylius:
form:
collection:
add: Προσθήκη
delete: Διαγραφή
Expand Up @@ -36,9 +36,9 @@ sylius:
configuration: Configuratie
description: Omschrijving
enabled: Toegestaan
match_all_category_requirement: Alle eenheden moeten dezelfde categorie hebben
match_any_category_requirement: Minstens 1 eenheid moet dezelfde categorie hebben
match_none_category_requirement: Geen van de eenheden moeten dezelfde categorie hebben
match_all_category_requirement: Alle eenheden moeten overeenkomen met de methodecategorie
match_any_category_requirement: Minstens 1 eenheid moet overeenkomen met de methodecategorie
match_none_category_requirement: Geen van de eenheden hoeven overeen te komen met de methodecategorie
name: Naam
position: Positie
tax_category: Belasting categorie
Expand Down
Expand Up @@ -76,6 +76,7 @@ sylius:
date: 'Ημερομηνία'
datetime: 'Ημερομηνία και ώρα'
default_locale: 'Προεπιλεγμένες τοπικές ρυθμίσεις'
delete: 'Διαγραφή'
description: 'Περιγραφή'
editing_country: 'Επεξεργασία χώρας'
editing_zone: 'Επεξεργασία ζώνης'
Expand Down
Expand Up @@ -10,4 +10,5 @@ sylius:
verify_email: 'Το email σας έχει επαληθευτεί με επιτυχία.'
verify_email_by_invalid_token: 'Το διακριτικό επαλήθευσης δεν είναι έγκυρο.'
verify_email_request: 'Ένα email με σύνδεσμο επαλήθευσης έχει σταλεί στην διεύθυνση email σας.'
verify_no_user: 'Δεν υπάρχει κανένας συνδεδεμένος χρήστης.'
verify_verified_email: 'Το email σας έχει ήδη επαληθευτεί.'
15 changes: 15 additions & 0 deletions src/Sylius/Component/Attribute/Model/Attribute.php
Expand Up @@ -16,12 +16,14 @@
use Sylius\Component\Attribute\AttributeType\TextAttributeType;
use Sylius\Component\Resource\Model\TimestampableTrait;
use Sylius\Component\Resource\Model\TranslatableTrait;
use Sylius\Component\Resource\Model\TranslationInterface;

class Attribute implements AttributeInterface
{
use TimestampableTrait;
use TranslatableTrait {
__construct as private initializeTranslationsCollection;
getTranslation as private doGetTranslation;
}

/**
Expand Down Expand Up @@ -173,6 +175,19 @@ public function setPosition(?int $position): void
$this->position = $position;
}

/**
* @param string|null $locale
*
* @return AttributeTranslationInterface
*/
public function getTranslation(?string $locale = null): TranslationInterface
{
/** @var AttributeTranslationInterface $translation */
$translation = $this->doGetTranslation($locale);

return $translation;
}

/**
* @return AttributeTranslationInterface
*/
Expand Down
8 changes: 8 additions & 0 deletions src/Sylius/Component/Attribute/Model/AttributeInterface.php
Expand Up @@ -17,6 +17,7 @@
use Sylius\Component\Resource\Model\ResourceInterface;
use Sylius\Component\Resource\Model\TimestampableInterface;
use Sylius\Component\Resource\Model\TranslatableInterface;
use Sylius\Component\Resource\Model\TranslationInterface;

interface AttributeInterface extends
ResourceInterface,
Expand Down Expand Up @@ -73,4 +74,11 @@ public function getPosition(): ?int;
* @param int|null $position
*/
public function setPosition(?int $position): void;

/**
* @param string|null $locale
*
* @return AttributeTranslationInterface
*/
public function getTranslation(?string $locale = null): TranslationInterface;
}
11 changes: 11 additions & 0 deletions src/Sylius/Component/Core/Model/CustomerInterface.php
Expand Up @@ -16,6 +16,7 @@
use Doctrine\Common\Collections\Collection;
use Sylius\Component\Customer\Model\CustomerInterface as BaseCustomerInterface;
use Sylius\Component\User\Model\UserAwareInterface;
use Sylius\Component\User\Model\UserInterface;

interface CustomerInterface extends BaseCustomerInterface, UserAwareInterface, ProductReviewerInterface
{
Expand Down Expand Up @@ -60,4 +61,14 @@ public function getAddresses(): Collection;
* @return bool
*/
public function hasUser(): bool;

/**
* @return ShopUserInterface|UserInterface|null
*/
public function getUser(): ?UserInterface;

/**
* @param ShopUserInterface|UserInterface|null $user
*/
public function setUser(?UserInterface $user);
}
11 changes: 11 additions & 0 deletions src/Sylius/Component/Core/Model/Product.php
Expand Up @@ -18,6 +18,7 @@
use Sylius\Component\Channel\Model\ChannelInterface as BaseChannelInterface;
use Sylius\Component\Product\Model\Product as BaseProduct;
use Sylius\Component\Product\Model\ProductTranslationInterface as BaseProductTranslationInterface;
use Sylius\Component\Resource\Model\TranslationInterface;
use Sylius\Component\Review\Model\ReviewInterface;
use Sylius\Component\Taxonomy\Model\TaxonInterface as BaseTaxonInterface;
use Webmozart\Assert\Assert;
Expand Down Expand Up @@ -347,6 +348,16 @@ public static function getVariantSelectionMethodLabels(): array
];
}

/**
* @param string|null $locale
*
* @return ProductTranslationInterface
*/
public function getTranslation(?string $locale = null): TranslationInterface
{
return parent::getTranslation($locale);
}

/**
* {@inheritdoc}
*/
Expand Down
8 changes: 8 additions & 0 deletions src/Sylius/Component/Core/Model/ProductInterface.php
Expand Up @@ -16,6 +16,7 @@
use Doctrine\Common\Collections\Collection;
use Sylius\Component\Channel\Model\ChannelsAwareInterface;
use Sylius\Component\Product\Model\ProductInterface as BaseProductInterface;
use Sylius\Component\Resource\Model\TranslationInterface;
use Sylius\Component\Review\Model\ReviewableInterface;
use Sylius\Component\Review\Model\ReviewInterface;

Expand Down Expand Up @@ -83,4 +84,11 @@ public function setMainTaxon(?TaxonInterface $mainTaxon): void;
* @return Collection|ReviewInterface[]
*/
public function getAcceptedReviews(): Collection;

/**
* @param string|null $locale
*
* @return ProductTranslationInterface
*/
public function getTranslation(?string $locale = null): TranslationInterface;
}
15 changes: 15 additions & 0 deletions src/Sylius/Component/Payment/Model/PaymentMethod.php
Expand Up @@ -16,12 +16,14 @@
use Sylius\Component\Resource\Model\TimestampableTrait;
use Sylius\Component\Resource\Model\ToggleableTrait;
use Sylius\Component\Resource\Model\TranslatableTrait;
use Sylius\Component\Resource\Model\TranslationInterface;

class PaymentMethod implements PaymentMethodInterface
{
use TimestampableTrait, ToggleableTrait;
use TranslatableTrait {
__construct as initializeTranslationsCollection;
getTranslation as private doGetTranslation;
}

/**
Expand Down Expand Up @@ -163,6 +165,19 @@ public function setPosition(?int $position): void
$this->position = $position;
}

/**
* @param string|null $locale
*
* @return PaymentMethodTranslationInterface
*/
public function getTranslation(?string $locale = null): TranslationInterface
{
/** @var PaymentMethodTranslationInterface $translation */
$translation = $this->doGetTranslation($locale);

return $translation;
}

/**
* {@inheritdoc}
*/
Expand Down
8 changes: 8 additions & 0 deletions src/Sylius/Component/Payment/Model/PaymentMethodInterface.php
Expand Up @@ -18,6 +18,7 @@
use Sylius\Component\Resource\Model\TimestampableInterface;
use Sylius\Component\Resource\Model\ToggleableInterface;
use Sylius\Component\Resource\Model\TranslatableInterface;
use Sylius\Component\Resource\Model\TranslationInterface;

interface PaymentMethodInterface extends
CodeAwareInterface,
Expand Down Expand Up @@ -75,4 +76,11 @@ public function getPosition(): ?int;
* @param int|null $position
*/
public function setPosition(?int $position): void;

/**
* @param string|null $locale
*
* @return PaymentMethodTranslationInterface
*/
public function getTranslation(?string $locale = null): TranslationInterface;
}
15 changes: 15 additions & 0 deletions src/Sylius/Component/Product/Model/Product.php
Expand Up @@ -19,13 +19,15 @@
use Sylius\Component\Resource\Model\TimestampableTrait;
use Sylius\Component\Resource\Model\ToggleableTrait;
use Sylius\Component\Resource\Model\TranslatableTrait;
use Sylius\Component\Resource\Model\TranslationInterface;
use Webmozart\Assert\Assert;

class Product implements ProductInterface
{
use TimestampableTrait, ToggleableTrait;
use TranslatableTrait {
__construct as private initializeTranslationsCollection;
getTranslation as private doGetTranslation;
}

/**
Expand Down Expand Up @@ -435,6 +437,19 @@ public function isConfigurable(): bool
return !$this->isSimple();
}

/**
* @param string|null $locale
*
* @return ProductTranslationInterface
*/
public function getTranslation(?string $locale = null): TranslationInterface
{
/** @var ProductTranslationInterface $translation */
$translation = $this->doGetTranslation($locale);

return $translation;
}

/**
* {@inheritdoc}
*/
Expand Down
15 changes: 15 additions & 0 deletions src/Sylius/Component/Product/Model/ProductAssociationType.php
Expand Up @@ -15,12 +15,14 @@

use Sylius\Component\Resource\Model\TimestampableTrait;
use Sylius\Component\Resource\Model\TranslatableTrait;
use Sylius\Component\Resource\Model\TranslationInterface;

class ProductAssociationType implements ProductAssociationTypeInterface
{
use TimestampableTrait;
use TranslatableTrait {
__construct as private initializeTranslationsCollection;
getTranslation as private doGetTranslation;
}

/**
Expand Down Expand Up @@ -94,6 +96,19 @@ public function setName(?string $name): void
$this->getTranslation()->setName($name);
}

/**
* @param string|null $locale
*
* @return ProductAssociationTypeTranslationInterface
*/
public function getTranslation(?string $locale = null): TranslationInterface
{
/** @var ProductAssociationTypeTranslationInterface $translation */
$translation = $this->doGetTranslation($locale);

return $translation;
}

/**
* {@inheritdoc}
*/
Expand Down
Expand Up @@ -17,6 +17,7 @@
use Sylius\Component\Resource\Model\ResourceInterface;
use Sylius\Component\Resource\Model\TimestampableInterface;
use Sylius\Component\Resource\Model\TranslatableInterface;
use Sylius\Component\Resource\Model\TranslationInterface;

interface ProductAssociationTypeInterface extends
CodeAwareInterface,
Expand All @@ -33,4 +34,11 @@ public function getName(): ?string;
* @param string|null $name
*/
public function setName(?string $name): void;

/**
* @param null|string $locale
*
* @return ProductAssociationTypeTranslationInterface
*/
public function getTranslation(?string $locale = null): TranslationInterface;
}
8 changes: 8 additions & 0 deletions src/Sylius/Component/Product/Model/ProductInterface.php
Expand Up @@ -21,6 +21,7 @@
use Sylius\Component\Resource\Model\TimestampableInterface;
use Sylius\Component\Resource\Model\ToggleableInterface;
use Sylius\Component\Resource\Model\TranslatableInterface;
use Sylius\Component\Resource\Model\TranslationInterface;

interface ProductInterface extends
AttributeSubjectInterface,
Expand Down Expand Up @@ -149,4 +150,11 @@ public function isSimple(): bool;
* @return bool
*/
public function isConfigurable(): bool;

/**
* @param string|null $locale
*
* @return ProductTranslationInterface
*/
public function getTranslation(?string $locale = null): TranslationInterface;
}
15 changes: 15 additions & 0 deletions src/Sylius/Component/Product/Model/ProductOption.php
Expand Up @@ -17,12 +17,14 @@
use Doctrine\Common\Collections\Collection;
use Sylius\Component\Resource\Model\TimestampableTrait;
use Sylius\Component\Resource\Model\TranslatableTrait;
use Sylius\Component\Resource\Model\TranslationInterface;

class ProductOption implements ProductOptionInterface
{
use TimestampableTrait;
use TranslatableTrait {
__construct as private initializeTranslationsCollection;
getTranslation as private doGetTranslation;
}

/**
Expand Down Expand Up @@ -155,6 +157,19 @@ public function hasValue(ProductOptionValueInterface $value): bool
return $this->values->contains($value);
}

/**
* @param string|null $locale
*
* @return ProductOptionTranslationInterface
*/
public function getTranslation(?string $locale = null): TranslationInterface
{
/** @var ProductOptionTranslationInterface $translation */
$translation = $this->doGetTranslation($locale);

return $translation;
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit 1a8186f

Please sign in to comment.