backports murph-skeleton
This commit is contained in:
parent
a1e928de6e
commit
a5768ae4c0
|
@ -22,7 +22,7 @@ class Referer implements EntityInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=Node::class, inversedBy="nodeViews")
|
* @ORM\ManyToOne(targetEntity=Node::class, inversedBy="nodeViews")
|
||||||
* @ORM\JoinColumn(nullable=false)
|
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
|
||||||
*/
|
*/
|
||||||
private $node;
|
private $node;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class View implements EntityInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=Node::class, inversedBy="nodeViews")
|
* @ORM\ManyToOne(targetEntity=Node::class, inversedBy="nodeViews")
|
||||||
* @ORM\JoinColumn(nullable=false)
|
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
|
||||||
*/
|
*/
|
||||||
private $node;
|
private $node;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Gedmo\Mapping\Annotation as Gedmo;
|
use Gedmo\Mapping\Annotation as Gedmo;
|
||||||
use function Symfony\Component\String\u;
|
use function Symfony\Component\String\u;
|
||||||
|
use App\Core\Entity\Analytic\View;
|
||||||
|
use App\Core\Entity\Analytic\Referer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Gedmo\Tree(type="nested")
|
* @Gedmo\Tree(type="nested")
|
||||||
|
@ -143,12 +145,24 @@ class Node implements EntityInterface
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="boolean", options={"default"=0})
|
* @ORM\Column(type="boolean", options={"default"=0})
|
||||||
*/
|
*/
|
||||||
private $enableViewCounter = false;
|
protected $enableAnalytic = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(targetEntity=View::class, mappedBy="node")
|
||||||
|
*/
|
||||||
|
protected $analyticViews;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(targetEntity=Referer::class, mappedBy="node")
|
||||||
|
*/
|
||||||
|
protected $analyticReferers;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->children = new ArrayCollection();
|
$this->children = new ArrayCollection();
|
||||||
$this->aliasNodes = new ArrayCollection();
|
$this->aliasNodes = new ArrayCollection();
|
||||||
|
$this->analyticViews = new ArrayCollection();
|
||||||
|
$this->analyticReferers = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -555,14 +569,74 @@ class Node implements EntityInterface
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEnableViewCounter(): ?bool
|
public function getEnableAnalytic(): ?bool
|
||||||
{
|
{
|
||||||
return $this->enableViewCounter;
|
return $this->enableAnalytic;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setEnableViewCounter(bool $enableViewCounter): self
|
public function setEnableAnalytic(bool $enableAnalytic): self
|
||||||
{
|
{
|
||||||
$this->enableViewCounter = $enableViewCounter;
|
$this->enableAnalytic = $enableAnalytic;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|View[]
|
||||||
|
*/
|
||||||
|
public function getAnalyticViews(): Collection
|
||||||
|
{
|
||||||
|
return $this->analyticViews;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addAnalyticView(View $view): self
|
||||||
|
{
|
||||||
|
if (!$this->analyticViews->contains($view)) {
|
||||||
|
$this->analyticViews[] = $view;
|
||||||
|
$view->setNode($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeAnalyticView(View $view): self
|
||||||
|
{
|
||||||
|
if ($this->analyticViews->removeElement($view)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($view->getNode() === $this) {
|
||||||
|
$view->setNode(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|Referer[]
|
||||||
|
*/
|
||||||
|
public function getAnalyticReferers(): Collection
|
||||||
|
{
|
||||||
|
return $this->analyticReferers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addAnalyticReferer(Referer $referer): self
|
||||||
|
{
|
||||||
|
if (!$this->analyticReferers->contains($referer)) {
|
||||||
|
$this->analyticReferers[] = $referer;
|
||||||
|
$referer->setNode($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeAnalyticReferer(Referer $referer): self
|
||||||
|
{
|
||||||
|
if ($this->analyticReferers->removeElement($referer)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($referer->getNode() === $this) {
|
||||||
|
$referer->setNode(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,10 +61,10 @@ class NodeType extends AbstractType
|
||||||
);
|
);
|
||||||
|
|
||||||
$builder->add(
|
$builder->add(
|
||||||
'enableViewCounter',
|
'enableAnalytic',
|
||||||
CheckboxType::class,
|
CheckboxType::class,
|
||||||
[
|
[
|
||||||
'label' => 'Enable view counter',
|
'label' => 'Enable analytic',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'attr' => [
|
'attr' => [
|
||||||
],
|
],
|
||||||
|
|
|
@ -39,8 +39,7 @@
|
||||||
"Never": "Jamais"
|
"Never": "Jamais"
|
||||||
"URL": "URL"
|
"URL": "URL"
|
||||||
"Disable URL": "Désactiver l'URL"
|
"Disable URL": "Désactiver l'URL"
|
||||||
"Enable view counter": "Activer le compteur de vues"
|
"Enable analytic": "Activer l'analyse"
|
||||||
"Stats": "Statistiques"
|
|
||||||
"Controller": "Contrôleur"
|
"Controller": "Contrôleur"
|
||||||
"Leave blank for automatic generation": "Laisser vide pour une génération automatique"
|
"Leave blank for automatic generation": "Laisser vide pour une génération automatique"
|
||||||
"Leave blank to use the default one. Example: App\\Controller\\FooController::barAction": "Laisser vide pour utiliser celui par défaut. Exemple : App\\Controller\\FooController::barAction"
|
"Leave blank to use the default one. Example: App\\Controller\\FooController::barAction": "Laisser vide pour utiliser celui par défaut. Exemple : App\\Controller\\FooController::barAction"
|
||||||
|
|
|
@ -205,7 +205,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ form_row(form.disableUrl) }}
|
{{ form_row(form.disableUrl) }}
|
||||||
{{ form_row(form.enableViewCounter) }}
|
{{ form_row(form.enableAnalytic) }}
|
||||||
{{ form_row(form.code) }}
|
{{ form_row(form.code) }}
|
||||||
{{ form_row(form.contentType) }}
|
{{ form_row(form.contentType) }}
|
||||||
{{ form_row(form.controller) }}
|
{{ form_row(form.controller) }}
|
||||||
|
|
Loading…
Reference in a new issue