<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
johnkhansrc / api-platform-stream-translate-bundle example snippets
use Johnkhansrc\ApiPlatformStreamTranslateBundle\Annotation\StreamTranslate;
/**
* @ApiResource
* @ORM\Entity(repositoryClass=AnyEntityRepository::class)
*/
class AnyEntity
{
/**
* @ORM\Id
*/
private $id;
/**
* Expect translation file anyDomain.xx.yaml who contain 'anykey' key
*
* @StreamTranslate(domain="anyDomain", key="anyKey")
*/
private string $anyStringPropertyKeyBasedExample;
/**
* Expect translation file anyDomain.xx.yaml who contain property value as key
*
* @StreamTranslate(domain="anyDomain")
*/
private string $anyStringPropertyNoKeyBasedExample;
/**
* * * NEW ON 2.0.0 * * *
* Iterate on each embed relation, don't forget do annotate related class properties.
* Tips: You can use different domain on related class property's annotation.
*
* @StreamTranslate(domain="anyDomain", childs=true)
*/
private ArrayCollection $anyStringPropertyNoKeyBasedExample;
}
use Johnkhansrc\ApiPlatformStreamTranslateBundle\Attribute\StreamTranslate;
/**
* @ApiResource
* @ORM\Entity(repositoryClass=AnyEntityRepository::class)
*/
class AnyEntity
{
/**
* @ORM\Id
*/
private $id;
/**
* Expect translation file anyDomain.xx.yaml who contain 'anykey' key
*/
#[StreamTranslate(domain: "anyDomain", key: "anyKey")]
private string $anyStringPropertyKeyBasedExample;
/**
* Expect translation file anyDomain.xx.yaml who contain property value as key
*/
#[StreamTranslate(domain: "anyDomain")]
private string $anyStringPropertyNoKeyBasedExample;
/**
* * * NEW ON 2.0.0 * * *
* Iterate on each embed relation, don't forget do annotate related class properties.
* Tips: You can use different domain on related class property's annotation.
*/
#[StreamTranslate(domain: "anyDomain", childs: true)]
private ArrayCollection $anyStringPropertyNoKeyBasedExample;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.