Browse Source

structure des entités / models

reduction
Fab 4 years ago
parent
commit
a516970419
7 changed files with 204 additions and 4 deletions
  1. +1
    -0
      README.md
  2. +12
    -0
      ShopBundle/Context/MerchantInterface.php
  3. +1
    -1
      ShopBundle/Context/UserInterface.php
  4. +118
    -0
      ShopBundle/Model/AbstractDocumentEntity.php
  5. +3
    -2
      ShopBundle/Model/AbstractEntity.php
  6. +1
    -1
      ShopBundle/Model/Merchant.php
  7. +68
    -0
      ShopBundle/Model/User.php

+ 1
- 0
README.md View File

@@ -0,0 +1 @@
#Laclic LcShopBundle

+ 12
- 0
ShopBundle/Context/MerchantInterface.php View File

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

namespace Lc\ShopBundle\Context;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;


interface MerchantInterface
{

}

ShopBundle/Model/UserInterface.php → ShopBundle/Context/UserInterface.php View File

@@ -1,6 +1,6 @@
<?php

namespace Lc\ShopBundle\Model;
namespace Lc\ShopBundle\Context;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

+ 118
- 0
ShopBundle/Model/AbstractDocumentEntity.php View File

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

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\ShopBundle\Model\AbstractEntity;

/**
* @ORM\MappedSuperclass
*/
abstract class AbstractDocumentEntity extends AbstractEntity
{
/**
* @ORM\Column(type="string", length=255)
*/
private $title;

/**
* @ORM\Column(type="string", length=255)
* @Gedmo\Slug(fields={"title"})
*/
private $slug;

/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $image;

/**
* @ORM\Column(type="float")
*/
private $status;

/**
* @ORM\Column(type="integer")
* @Gedmo\SortablePosition()
*/
private $position;


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

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

return $this;
}

public function getSlug(): ?string
{
return $this->slug;
}

public function setSlug(string $slug): self
{
$this->slug = $slug;

return $this;
}

public function getDescription(): ?string
{
return $this->description;
}

public function setDescription(?string $description): self
{
$this->description = $description;

return $this;
}

public function getImage(): ?string
{
return $this->image;
}

public function setImage(?string $image): self
{
$this->image = $image;

return $this;
}

public function getStatus(): ?float
{
return $this->status;
}

public function setStatus(float $status): self
{
$this->status = $status;

return $this;
}

public function getPosition(): ?int
{
return $this->position;
}

public function setPosition(int $position): self
{
$this->position = $position;

return $this;
}
}

+ 3
- 2
ShopBundle/Model/AbstractEntity.php View File

@@ -4,6 +4,7 @@ namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\ShopBundle\Context\UserInterface;

/**
* @ORM\MappedSuperclass
@@ -24,13 +25,13 @@ abstract class AbstractEntity
protected $updatedAt;

/**
* @ORM\ManyToOne(targetEntity="UserInterface")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $createdBy;

/**
* @ORM\ManyToOne(targetEntity="UserInterface")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $updatedBy;

+ 1
- 1
ShopBundle/Model/Merchant.php View File

@@ -9,7 +9,7 @@ use Gedmo\Mapping\Annotation as Gedmo;
* @ORM\MappedSuperclass()
*/

class Merchant
abstract class Merchant extends AbstractDocumentEntity
{

}

+ 68
- 0
ShopBundle/Model/User.php View File

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

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\User as UserModelFOS;
use Lc\ShopBundle\Context\MerchantInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class User //extends UserModelFOS
{

/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
protected $phone;

/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
protected $behaviorDisplayPrice;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
*/
protected $merchant;


public function getPhone(): ?string
{
return $this->phone;
}

public function setPhone(?string $phone): self
{
$this->phone = $phone;

return $this;
}

public function getBehaviorDisplayPrice(): ?string
{
return $this->behaviorDisplayPrice;
}

public function setBehaviorDisplayPrice(?string $behaviorDisplayPrice): self
{
$this->behaviorDisplayPrice = $behaviorDisplayPrice;

return $this;
}

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

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

return $this;
}


}

Loading…
Cancel
Save