Commit 8a907a2b authored by François Agneray's avatar François Agneray
Browse files

Changement des entities vers nouveau schéma

parent 23302e0a
......@@ -27,7 +27,7 @@ class Attribute implements \JsonSerializable
protected $id;
/**
* @var Anis\Entity\Dataset
* @var App\Entity\Dataset
*
* @Id
* @ManyToOne(targetEntity="Dataset", inversedBy="attributes")
......@@ -196,6 +196,13 @@ class Attribute implements \JsonSerializable
*/
protected $rendererDetail;
/**
* @var string
*
* @Column(type="json", name="options", nullable=true)
*/
protected $options;
/**
* @var string
*
......@@ -239,28 +246,20 @@ class Attribute implements \JsonSerializable
protected $voSize;
/**
* @var Anis\Entity\DatasetCriteriaFamily
*
* @ManyToOne(targetEntity="DatasetCriteriaFamily", inversedBy="attributes")
* @JoinColumn(name="dataset_criteriafamily_id", referencedColumnName="id", nullable=true)
*/
protected $datasetCriteriaFamily;
/**
* @var Anis\Entity\DatasetOutputFamilyCategory
* @var App\Entity\CriteriaFamily
*
* @ManyToOne(targetEntity="DatasetOutputFamilyCategory", inversedBy="attributes")
* @JoinColumn(name="dataset_outputfamily_category_id", referencedColumnName="id", nullable=true)
* @ManyToOne(targetEntity="CriteriaFamily", inversedBy="attributes")
* @JoinColumn(name="criteria_family", referencedColumnName="id", nullable=true)
*/
protected $datasetOutputFamilyCategory;
protected $criteriaFamily;
/**
* @var Anis\Entity\Option[]
* @var App\Entity\OutputCategory
*
* @OneToMany(targetEntity="Option", mappedBy="attribute", cascade={"remove"})
* @OrderBy({"display" = "ASC"})
* @ManyToOne(targetEntity="OutputCategory", inversedBy="attributes")
* @JoinColumn(name="output_category", referencedColumnName="id", nullable=true)
*/
protected $options;
protected $outputCategory;
public function __construct($id, $dataset)
{
......@@ -563,34 +562,29 @@ class Attribute implements \JsonSerializable
$this->rendererDetail = $rendererDetail;
}
public function getDataset()
public function getOptions()
{
return $this->dataset;
return $this->options;
}
public function getDatasetCriteriaFamily()
public function setOptions($options)
{
return $this->datasetCriteriaFamily;
$this->options = $options;
}
public function setDatasetCriteriaFamily($datasetCriteriaFamily)
{
$this->datasetCriteriaFamily = $datasetCriteriaFamily;
}
public function getDatasetOutputFamilyCategory()
public function getDataset()
{
return $this->datasetOutputFamilyCategory;
return $this->dataset;
}
public function setDatasetOutputFamilyCategory($datasetOutputFamilyCategory)
public function getCriteriaFamily()
{
$this->datasetOutputFamilyCategory = $datasetOutputFamilyCategory;
return $this->criteriaFamily;
}
public function getOptions()
public function getOutputCategory()
{
return $this->options;
return $this->outputCategory;
}
public function jsonSerialize()
......@@ -620,15 +614,15 @@ class Attribute implements \JsonSerializable
'order_display' => $this->getOrderDisplay(),
'detail' => $this->getDetail(),
'renderer_detail' => $this->getRendererDetail(),
'options' => $this->getOptions(),
'vo_utype' => $this->getVoUtype(),
'vo_ucd' => $this->getVoUcd(),
'vo_unit' => $this->getVoUnit(),
'vo_description' => $this->getVoDescription(),
'vo_datatype' => $this->getVoDatatype(),
'vo_size' => $this->getVoSize(),
'id_criteria_family' => is_null($this->getDatasetCriteriaFamily()) ? null : $this->getDatasetCriteriaFamily()->getCriteriaFamily()->getId(),
'id_output_family' => is_null($this->getDatasetOutputFamilyCategory()) ? null : $this->getDatasetOutputFamilyCategory()->getDatasetOutputFamily()->getOutputFamily()->getId(),
'id_category' => is_null($this->getDatasetOutputFamilyCategory()) ? null : $this->getDatasetOutputFamilyCategory()->getCategory()->getId()
'id_criteria_family' => $this->getCriteriaFamily(),
'id_output_category' => $this->getOutputCategory()
];
}
}
<?php declare(strict_types=1);
/*
* This file is part of ANIS SERVER API.
*
* (c) François Agneray <francois.agneray@lam.fr>
* (c) Chrystel Moreau <chrystel.moreau@lam.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Entity;
/**
* @Entity
* @Table(name="category")
*/
class Category implements \JsonSerializable
{
/**
* @var integer
*
* @Id
* @Column(type="integer", nullable=false)
* @GeneratedValue
*/
protected $id;
/**
* @var string
*
* @Column(type="string", nullable=false)
*/
protected $label;
public function getId()
{
return $this->id;
}
public function getLabel()
{
return $this->label;
}
public function setLabel($label)
{
$this->label = $label;
}
public function jsonSerialize()
{
return [
'id' => $this->getId(),
'label' => $this->getLabel()
];
}
}
......@@ -32,6 +32,21 @@ class CriteriaFamily implements \JsonSerializable
*/
protected $label;
/**
* @var integer
*
* @Column(type="integer", nullable=false)
*/
protected $display;
/**
* @var Anis\Entity\Attribute[]
*
* @OneToMany(targetEntity="Attribute", mappedBy="criteriaFamily")
* @OrderBy({"criteriaDisplay" = "ASC"})
*/
protected $attributes;
public function getId()
{
return $this->id;
......@@ -47,11 +62,27 @@ class CriteriaFamily implements \JsonSerializable
$this->label = $label;
}
public function getDisplay()
{
return $this->display;
}
public function setDisplay($display)
{
$this->display = $display;
}
public function getAttributes()
{
return $this->attributes;
}
public function jsonSerialize()
{
return [
'id' => $this->getId(),
'label' => $this->getLabel(),
'display' => $this->getDisplay(),
'type' => 'criteria'
];
}
......
......@@ -106,35 +106,12 @@ class Dataset implements \JsonSerializable
*/
protected $files;
/**
* @var Anis\Entity\Join[]
*
* @OneToMany(targetEntity="Join", mappedBy="dataset", cascade={"remove"})
*/
protected $joins;
/**
* @var Anis\Entity\DatasetPrivileges
*
* @OneToMany(targetEntity="DatasetPrivileges", mappedBy="dataset")
*/
protected $datasetPrivileges;
/**
* @var Anis\Entity\DatasetOutputFamily
*
* @OneToMany(targetEntity="DatasetOutputFamily", mappedBy="dataset", cascade={"remove"})
* @OrderBy({"display" = "ASC"})
*/
protected $datasetOutputFamilies;
/**
* @var Anis\Entity\DatasetCriteriaFamily
*
* @OneToMany(targetEntity="DatasetCriteriaFamily", mappedBy="dataset", cascade={"remove"})
* @OrderBy({"display" = "ASC"})
*/
protected $datasetCriteriaFamilies;
public function __construct($name)
{
......@@ -257,16 +234,6 @@ class Dataset implements \JsonSerializable
return $this->datasetPrivileges;
}
public function getDatasetOutputFamilies()
{
return $this->datasetOutputFamilies;
}
public function getDatasetCriteriaFamilies()
{
return $this->datasetCriteriaFamilies;
}
public function jsonSerialize()
{
return [
......
<?php declare(strict_types=1);
/*
* This file is part of ANIS SERVER API.
*
* (c) François Agneray <francois.agneray@lam.fr>
* (c) Chrystel Moreau <chrystel.moreau@lam.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Entity;
/**
* @Entity
* @Table(name="dataset_x_criteriafamily")
*/
class DatasetCriteriaFamily implements \JsonSerializable
{
/**
* @var integer
*
* @Id
* @Column(type="integer", nullable=false)
* @GeneratedValue
*/
protected $id;
/**
* @var Anis\Entity\Dataset
*
* @ManyToOne(targetEntity="Dataset", inversedBy="datasetCriteriaFamilies")
* @JoinColumn(name="dataset_name", referencedColumnName="name", nullable=false)
*/
protected $dataset;
/**
* @var Anis\Entity\CriteriaFamily
*
* @ManyToOne(targetEntity="CriteriaFamily")
* @JoinColumn(name="criteria_family_id", referencedColumnName="id", nullable=false)
*/
protected $criteriaFamily;
/**
* @var Anis\Entity\Attribute[]
*
* @OneToMany(targetEntity="Attribute", mappedBy="datasetCriteriaFamily")
* @OrderBy({"criteriaDisplay" = "ASC"})
*/
protected $attributes;
/**
* @var integer
*
* @Column(type="integer", nullable=true)
*/
protected $display;
public function __construct(Dataset $dataset, CriteriaFamily $criteriaFamily)
{
$this->dataset = $dataset;
$this->criteriaFamily = $criteriaFamily;
}
public function getId()
{
return $this->id;
}
public function getDataset()
{
return $this->dataset;
}
public function getCriteriaFamily()
{
return $this->criteriaFamily;
}
public function getAttributes()
{
return $this->attributes;
}
public function getDisplay()
{
return $this->display;
}
public function setDisplay($display)
{
$this->display = (int) $display;
}
public function jsonSerialize()
{
return [
'id' => $this->getId(),
'criteria' => $this->getCriteriaFamily()->getId(),
'attributes' => array_map(function ($a) {
return $a->getId();
}, $this->getAttributes()->getValues()),
'display' => $this->getDisplay()
];
}
}
<?php declare(strict_types=1);
/*
* This file is part of ANIS SERVER API.
*
* (c) François Agneray <francois.agneray@lam.fr>
* (c) Chrystel Moreau <chrystel.moreau@lam.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Entity;
/**
* @Entity
* @Table(name="dataset_x_outputfamily")
*/
class DatasetOutputFamily implements \JsonSerializable
{
/**
* @var integer
*
* @Id
* @Column(type="integer", nullable=false)
* @GeneratedValue
*/
protected $id;
/**
* @var Anis\Entity\Dataset
*
* @ManyToOne(targetEntity="Dataset", inversedBy="datasetOutputFamilies")
* @JoinColumn(name="dataset_name", referencedColumnName="name", nullable=false)
*/
protected $dataset;
/**
* @var Anis\Entity\OutputFamily
*
* @ManyToOne(targetEntity="OutputFamily")
* @JoinColumn(name="output_family_id", referencedColumnName="id", nullable=false)
*/
protected $outputFamily;
/**
* @var Anis\Entity\DatasetOutputFamilyCategory
*
* @OneToMany(targetEntity="DatasetOutputFamilyCategory", mappedBy="datasetOutputFamily", cascade={"remove"})
* @OrderBy({"display" = "ASC"})
*/
protected $datasetOutputFamilyCategories;
/**
* @var integer
*
* @Column(type="integer", nullable=true)
*/
protected $display;
public function __construct($dataset, $outputFamily)
{
$this->dataset = $dataset;
$this->outputFamily = $outputFamily;
}
public function getId()
{
return $this->id;
}
public function getDataset()
{
return $this->dataset;
}
public function getOutputFamily()
{
return $this->outputFamily;
}
public function getDatasetOutputFamilyCategories()
{
return $this->datasetOutputFamilyCategories;
}
public function getDisplay()
{
return $this->display;
}
public function setDisplay($display)
{
$this->display = (int) $display;
}
public function jsonSerialize()
{
return [
'id' => $this->getId(),
'output' => $this->getOutputFamily()->getId(),
'categories' => $this->getDatasetOutputFamilyCategories()->getValues(),
'display' => $this->getDisplay()
];
}
}
<?php declare(strict_types=1);
/*
* This file is part of ANIS SERVER API.
*
* (c) François Agneray <francois.agneray@lam.fr>
* (c) Chrystel Moreau <chrystel.moreau@lam.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Entity;
/**
* @Entity
* @Table(name="dataset_outputfamily_x_category")
*/
class DatasetOutputFamilyCategory implements \JsonSerializable
{
/**
* @var integer
*
* @Id
* @Column(type="integer", nullable=false)
* @GeneratedValue
*/
protected $id;
/**
* @var Anis\Entity\DatasetOutputFamily
*
* @ManyToOne(targetEntity="DatasetOutputFamily", inversedBy="datasetOutputFamilyCategories")
* @JoinColumn(name="dataset_output_family_id", referencedColumnName="id", nullable=false)
*/
protected $datasetOutputFamily;
/**
* @var Anis\Entity\Category
*
* @ManyToOne(targetEntity="Category")
* @JoinColumn(name="category_id", referencedColumnName="id", nullable=false)
*/
protected $category;
/**
* @var Anis\Entity\Attribute[]
*
* @OneToMany(targetEntity="Attribute", mappedBy="datasetOutputFamilyCategory")
* @OrderBy({"outputDisplay" = "ASC"})
*/
protected $attributes;
/**
* @var integer
*
* @Column(type="integer", nullable=true)
*/
protected $display;
public function __construct($datasetOutputFamily, $category)
{
$this->datasetOutputFamily = $datasetOutputFamily;
$this->category = $category;
}
public function getId()
{
return $this->id;
}
public function getDatasetOutputFamily()
{
return $this->datasetOutputFamily;
}
public function getCategory()
{
return $this->category;
}
public function getAttributes()
{
return $this->attributes;
}
public function getDisplay()
{
return $this->display;
}
public function setDisplay($display)
{
$this->display = (int) $display;
}
public function jsonSerialize()
{
return [
'id' => $this->getId(),
'category' => $this->getCategory()->getId(),
'attributes' => array_map(function ($a) {
return $a->getId();
}, $this->getAttributes()->getValues()),
'display' => $this->getDisplay()
];
}
}
......@@ -41,20 +41,6 @@ class DatasetPrivileges
*/
protected $visible;
/**
* @var bool
*
* @Column(type="boolean", name="create_row", nullable=false)
*/
protected $createRow;
/**
* @var bool
*
* @Column(type="boolean", name="delete_row", nullable=false)
*/
protected $deleteRow;
public function __construct(Dataset $dataset, Group $group)
{
$this->dataset = $dataset;
......@@ -80,24 +66,4 @@ class DatasetPrivileges
{
$this->visible = (bool) $visible;
}
public function getCreateRow()