Last active
May 19, 2017 11:58
-
-
Save ohvitorino/bdc020038b38ce047787dffd06911d25 to your computer and use it in GitHub Desktop.
Generator for entities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace ProductsBundle\Command; | |
final class CreateProduct extends ProductDataTransferObject | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace ProductsBundle\Command; | |
use ProductsBundle\Entity\Product; | |
final class CreateProductHandler | |
{ | |
public function handle(CreateProduct $createProduct): void | |
{ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace ProductsBundle\Entity; | |
use Doctrine\Common\Collections\ArrayCollection; | |
use Doctrine\Common\Collections\Collection; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @ORM\Entity | |
* @ORM\Table | |
*/ | |
final class Product | |
{ | |
/** | |
* @var int | |
* | |
* @ORM\Id | |
* @ORM\GeneratedValue(strategy="AUTO") | |
* @ORM\Column(type="integer") | |
*/ | |
private $id; | |
/** | |
* @var Collection | |
* | |
* @ORM\OneToMany( | |
* targetEntity="ProductsBundle\Entity\ProductTranslation", | |
* mappedBy="product", | |
* cascade={"all"}, | |
* orphanRemoval=true | |
* ) | |
*/ | |
private $translations; | |
public function __construct() | |
{ | |
$this->translations = new ArrayCollection(); | |
} | |
public function getId(): int | |
{ | |
return $this->id; | |
} | |
public function getTranslations(): Collection | |
{ | |
return $this->translations; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace ProductsBundle\Command; | |
use Doctrine\Common\Collections\ArrayCollection; | |
use Doctrine\Common\Collections\Collection; | |
use ProductsBundle\Entity\Product; | |
class ProductDataTransferObject | |
{ | |
/** | |
* @var Collection | |
*/ | |
public $translations; | |
public function __construct() | |
{ | |
$this->translations = new ArrayCollection(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment