Last active
July 13, 2021 06:00
-
-
Save kurozumi/c0febeeee355cf49a5d57df95284a350 to your computer and use it in GitHub Desktop.
Productエンティティに自動登録する会員グループを保存する項目を追加
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 | |
/** | |
* This file is part of CustomerGroupProduct | |
* | |
* Copyright(c) Akira Kurozumi <[email protected]> | |
* | |
* https://a-zumi.net | |
* | |
* For the full copyright and license information, please view the LICENSE | |
* file that was distributed with this source code. | |
*/ | |
namespace Plugin\CustomerGroupProduct\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use Eccube\Annotation\EntityExtension; | |
use Plugin\CustomerGroup\Entity\Group; | |
/** | |
* Class ProductTrait | |
* @package Plugin\CustomerGroupProduct\Entity | |
* | |
* @EntityExtension("Eccube\Entity\Product") | |
*/ | |
trait ProductTrait | |
{ | |
/** | |
* @var Group | |
* | |
* @ORM\ManyToOne(targetEntity="Plugin\CustomerGroup\Entity\Group") | |
* @ORM\JoinColumn(referencedColumnName="id") | |
*/ | |
private $registerGroup; | |
/** | |
* @return Group|null | |
*/ | |
public function getRegisterGroup(): ?Group | |
{ | |
return $this->registerGroup; | |
} | |
/** | |
* @return bool | |
*/ | |
public function hasRegisterGroup(): bool | |
{ | |
return $this->registerGroup instanceof Group; | |
} | |
/** | |
* @param Group $registerGroup | |
* @return $this | |
*/ | |
public function setRegisterGroup(Group $registerGroup): self | |
{ | |
$this->registerGroup = $registerGroup; | |
return $this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment