mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-27 09:05:01 +00:00
First commit
This commit is contained in:
142
src/CL/CustomFieldsBundle/Entity/BlopEntity.php
Normal file
142
src/CL/CustomFieldsBundle/Entity/BlopEntity.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
namespace CL\CustomFieldsBundle\Entity;
|
||||
|
||||
/**
|
||||
* BlopEntity
|
||||
*/
|
||||
class BlopEntity
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $field1;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $field2;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $customField;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field1
|
||||
*
|
||||
* @param string $field1
|
||||
*
|
||||
* @return BlopEntity
|
||||
*/
|
||||
public function setField1($field1)
|
||||
{
|
||||
$this->field1 = $field1;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field1
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getField1()
|
||||
{
|
||||
return $this->field1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field2
|
||||
*
|
||||
* @param string $field2
|
||||
*
|
||||
* @return BlopEntity
|
||||
*/
|
||||
public function setField2($field2)
|
||||
{
|
||||
$this->field2 = $field2;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field2
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getField2()
|
||||
{
|
||||
return $this->field2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set customField
|
||||
*
|
||||
* @param array $customField
|
||||
*
|
||||
* @return BlopEntity
|
||||
*/
|
||||
public function setCustomField($customField)
|
||||
{
|
||||
$this->customField = $customField;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get customField
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCustomField()
|
||||
{
|
||||
return $this->customField;
|
||||
}
|
||||
|
||||
public function cfGet($key)
|
||||
{
|
||||
echo "<br> -1- <br>";
|
||||
echo gettype($this->customField);
|
||||
echo "<br> -2- <br>";
|
||||
echo $this->customField;
|
||||
echo "<br> -3- <br>";
|
||||
var_dump(json_decode($this->customField));
|
||||
echo "<br> -4- <br>";
|
||||
echo json_last_error_msg();
|
||||
|
||||
$customFieldArray = json_decode($this->customField, true);
|
||||
|
||||
if(array_key_exists($key, $customFieldArray)) {
|
||||
return $customFieldArray[$key];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function cfSet($key, $value)
|
||||
{
|
||||
echo "-";
|
||||
$customFieldArray = json_decode($this->customField, true);
|
||||
$customFieldArray[$key] = $value;
|
||||
$this->setCustomField(json_encode($customFieldArray));
|
||||
var_dump($customFieldArray);
|
||||
}
|
||||
}
|
||||
|
113
src/CL/CustomFieldsBundle/Entity/CustomField.php
Normal file
113
src/CL/CustomFieldsBundle/Entity/CustomField.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace CL\CustomFieldsBundle\Entity;
|
||||
|
||||
/**
|
||||
* CustomField
|
||||
*/
|
||||
class CustomField
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $label;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
private $active;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set label
|
||||
*
|
||||
* @param string $label
|
||||
*
|
||||
* @return CustomField
|
||||
*/
|
||||
public function setLabel($label)
|
||||
{
|
||||
$this->label = $label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get label
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set type
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return CustomField
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set active
|
||||
*
|
||||
* @param boolean $active
|
||||
*
|
||||
* @return CustomField
|
||||
*/
|
||||
public function setActive($active)
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get active
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getActive()
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user