Last active
June 5, 2018 16:25
-
-
Save covex-nn/79fb3dacc6a7c3692b532c4567b5f337 to your computer and use it in GitHub Desktop.
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 | |
declare(strict_types=1); | |
namespace App\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use JMS\Serializer\Annotation as Serializer; | |
use Sonata\ClassificationBundle\Entity\BaseCategory; | |
use Symfony\Component\Validator\Constraints as Assert; | |
/** | |
* @ORM\Entity | |
* @ORM\Table(name="classification__category") | |
* @ORM\HasLifecycleCallbacks | |
*/ | |
class SonataClassificationCategory extends BaseCategory | |
{ | |
/** | |
* @ORM\Id | |
* @ORM\Column(type="integer") | |
* @ORM\GeneratedValue(strategy="AUTO") | |
* // Serializer\Groups(groups={"sonata_api_read", "sonata_api_write", "sonata_search"}) | |
* | |
* @var int | |
*/ | |
protected $id; | |
/** | |
* @ORM\OneToMany( | |
* targetEntity="App\Entity\SonataClassificationCategory", | |
* mappedBy="parent", cascade={"persist"}, orphanRemoval=true | |
* ) | |
* @ORM\OrderBy({"position"="ASC"}) | |
* | |
* @var SonataClassificationCategory[] | |
*/ | |
protected $children; | |
/** | |
* @ORM\ManyToOne( | |
* targetEntity="App\Entity\SonataClassificationCategory", | |
* inversedBy="children", cascade={"persist", "refresh", "merge", "detach"} | |
* ) | |
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE") | |
* | |
* @var SonataClassificationCategory | |
*/ | |
protected $parent; | |
/** | |
* @ORM\ManyToOne( | |
* targetEntity="App\Entity\SonataClassificationContext", | |
* cascade={"persist"} | |
* ) | |
* @ORM\JoinColumn(name="context", referencedColumnName="id", nullable=false) | |
* @Assert\NotNull() | |
* | |
* @var SonataClassificationContext | |
*/ | |
protected $context; | |
public function getId() | |
{ | |
return $this->id; | |
} | |
/** | |
* @ORM\PrePersist | |
*/ | |
public function prePersist(): void | |
{ | |
parent::prePersist(); | |
} | |
/** | |
* @ORM\PreUpdate | |
*/ | |
public function preUpdate(): void | |
{ | |
parent::preUpdate(); | |
} | |
} |
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 | |
declare(strict_types=1); | |
namespace App\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use JMS\Serializer\Annotation as Serializer; | |
use Sonata\ClassificationBundle\Entity\BaseCollection; | |
/** | |
* @ORM\Entity | |
* @ORM\Table(name="classification__collection") | |
* @ORM\HasLifecycleCallbacks | |
*/ | |
class SonataClassificationCollection extends BaseCollection | |
{ | |
/** | |
* @ORM\Id | |
* @ORM\Column(type="integer") | |
* @ORM\GeneratedValue(strategy="AUTO") | |
* // Serializer\Groups(groups={"sonata_api_read", "sonata_api_write", "sonata_search"}) | |
* | |
* @var int | |
*/ | |
protected $id; | |
/** | |
* @ORM\ManyToOne( | |
* targetEntity="App\Entity\SonataClassificationContext", | |
* cascade={"persist"} | |
* ) | |
* @ORM\JoinColumn(name="context", referencedColumnName="id", nullable=false) | |
* | |
* @var SonataClassificationContext | |
*/ | |
protected $context; | |
public function getId() | |
{ | |
return $this->id; | |
} | |
/** | |
* @ORM\PrePersist | |
*/ | |
public function prePersist(): void | |
{ | |
parent::prePersist(); | |
} | |
/** | |
* @ORM\PreUpdate | |
*/ | |
public function preUpdate(): void | |
{ | |
parent::preUpdate(); | |
} | |
} |
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 | |
declare(strict_types=1); | |
namespace App\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use JMS\Serializer\Annotation as Serializer; | |
use Sonata\ClassificationBundle\Entity\BaseContext; | |
/** | |
* @ORM\Entity | |
* @ORM\Table(name="classification__context") | |
* @ORM\HasLifecycleCallbacks | |
*/ | |
class SonataClassificationContext extends BaseContext | |
{ | |
/** | |
* @ORM\Id | |
* @ORM\Column(type="string") | |
* @ORM\GeneratedValue(strategy="NONE") | |
* // Serializer\Groups(groups={"sonata_api_read", "sonata_api_write", "sonata_search"}) | |
* | |
* @var int | |
*/ | |
protected $id; | |
public function getId() | |
{ | |
return $this->id; | |
} | |
/** | |
* @ORM\PrePersist | |
*/ | |
public function prePersist(): void | |
{ | |
parent::prePersist(); | |
} | |
/** | |
* @ORM\PreUpdate | |
*/ | |
public function preUpdate(): void | |
{ | |
parent::preUpdate(); | |
} | |
} |
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 | |
declare(strict_types=1); | |
namespace App\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use JMS\Serializer\Annotation as Serializer; | |
use Sonata\ClassificationBundle\Entity\BaseTag; | |
/** | |
* @ORM\Entity | |
* @ORM\Table(name="classification__tag") | |
* @ORM\HasLifecycleCallbacks | |
*/ | |
class SonataClassificationTag extends BaseTag | |
{ | |
/** | |
* @ORM\Id | |
* @ORM\Column(type="integer") | |
* @ORM\GeneratedValue(strategy="AUTO") | |
* // Serializer\Groups(groups={"sonata_api_read", "sonata_api_write", "sonata_search"}) | |
* | |
* @var int | |
*/ | |
protected $id; | |
/** | |
* @ORM\ManyToOne( | |
* targetEntity="App\Entity\SonataClassificationContext", | |
* cascade={"persist"} | |
* ) | |
* @ORM\JoinColumn(name="context", referencedColumnName="id", nullable=false) | |
* | |
* @var SonataClassificationContext | |
*/ | |
protected $context; | |
public function getId() | |
{ | |
return $this->id; | |
} | |
/** | |
* @ORM\PrePersist | |
*/ | |
public function prePersist(): void | |
{ | |
parent::prePersist(); | |
} | |
/** | |
* @ORM\PreUpdate | |
*/ | |
public function preUpdate(): void | |
{ | |
parent::preUpdate(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment