Переглянути джерело

Déplacement GroupUser Caracole -> Sov

feature/ticket
Fab 3 роки тому
джерело
коміт
bc2ccbea9b
4 змінених файлів з 144 додано та 0 видалено
  1. +14
    -0
      Controller/User/GroupUserAdminController.php
  2. +8
    -0
      Model/User/GroupUserInterface.php
  3. +100
    -0
      Model/User/GroupUserModel.php
  4. +22
    -0
      Repository/User/GroupUserRepository.php

+ 14
- 0
Controller/User/GroupUserAdminController.php Переглянути файл

@@ -0,0 +1,14 @@
<?php

namespace App\Controller\User;

use App\Entity\User\GroupUser;
use Lc\CaracoleBundle\Controller\User\GroupUserAdminController as CaracAbstractUserAdminController;

class GroupUserAdminController extends CaracAbstractUserAdminController
{
public static function getEntityFqcn(): string
{
return GroupUser::class;
}
}

+ 8
- 0
Model/User/GroupUserInterface.php Переглянути файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\CaracoleBundle\Model\User;

interface GroupUserInterface
{

}

+ 100
- 0
Model/User/GroupUserModel.php Переглянути файл

@@ -0,0 +1,100 @@
<?php

namespace Lc\CaracoleBundle\Model\User;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
use Lc\SovBundle\Model\User\UserInterface;


/**
* @ORM\MappedSuperclass()
*/
abstract class GroupUserModel extends AbstractLightEntity implements FilterMerchantInterface
{

/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="groupUsers")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\ManyToMany(targetEntity="Lc\SovBundle\Model\User\UserInterface", mappedBy="groupUsers")
*/
protected $users;


public function __toString()
{
return $this->getTitle();
}


public function __construct()
{
$this->users = new ArrayCollection();
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}

public function getMerchant(): ?MerchantInterface
{
return $this->merchant;
}

public function setMerchant(?MerchantInterface $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function addUser(UserModel $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
}

return $this;
}

/**
* @return Collection|UserInterface[]
*/
public function getUsers(): Collection
{
return $this->users;
}

public function removeUser(UserInterface $user): self
{
if ($this->users->contains($user)) {
$this->users->removeElement($user);
}

return $this;
}


}

+ 22
- 0
Repository/User/GroupUserRepository.php Переглянути файл

@@ -0,0 +1,22 @@
<?php

namespace Lc\CaracoleBundle\Repository\User;

use Lc\SovBundle\Model\User\GroupUserInterface;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method GroupUserInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method GroupUserInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method GroupUserInterface[] findAll()
* @method GroupUserInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class GroupUserRepository extends AbstractRepository
{
public function getInterfaceClass()
{
return GroupUserInterface::class;
}


}

Завантаження…
Відмінити
Зберегти