Remove EntityLog and revert doctrine.yaml for one entity manager. #330
This commit is contained in:
parent
b2154e28b8
commit
eb0fd34eec
2 changed files with 121 additions and 255 deletions
|
|
@ -4,13 +4,9 @@ parameters:
|
||||||
# environment variables are not available yet.
|
# environment variables are not available yet.
|
||||||
# You should not need to change this value.
|
# You should not need to change this value.
|
||||||
env(DATABASE_URL): ''
|
env(DATABASE_URL): ''
|
||||||
env(LOGGING_DATABASE_URL): ''
|
|
||||||
|
|
||||||
doctrine:
|
doctrine:
|
||||||
dbal:
|
dbal:
|
||||||
default_connection: default
|
|
||||||
connections:
|
|
||||||
default:
|
|
||||||
# configure these for your database server
|
# configure these for your database server
|
||||||
driver: 'pdo_mysql'
|
driver: 'pdo_mysql'
|
||||||
server_version: '5.7'
|
server_version: '5.7'
|
||||||
|
|
@ -18,36 +14,13 @@ doctrine:
|
||||||
|
|
||||||
# With Symfony 3.3, remove the `resolve:` prefix
|
# With Symfony 3.3, remove the `resolve:` prefix
|
||||||
url: '%env(resolve:DATABASE_URL)%'
|
url: '%env(resolve:DATABASE_URL)%'
|
||||||
logging:
|
|
||||||
# configure these for your database server
|
|
||||||
url: '%env(resolve:LOGGING_DATABASE_URL)%'
|
|
||||||
driver: 'pdo_mysql'
|
|
||||||
server_version: '5.7'
|
|
||||||
charset: utf8mb4
|
|
||||||
types:
|
types:
|
||||||
geometry: CrEOF\Spatial\DBAL\Types\GeometryType
|
geometry: CrEOF\Spatial\DBAL\Types\GeometryType
|
||||||
point: CrEOF\Spatial\DBAL\Types\Geometry\PointType
|
point: CrEOF\Spatial\DBAL\Types\Geometry\PointType
|
||||||
polygon: CrEOF\Spatial\DBAL\Types\Geometry\PolygonType
|
polygon: CrEOF\Spatial\DBAL\Types\Geometry\PolygonType
|
||||||
linestring: CrEOF\Spatial\DBAL\Types\Geometry\LineStringType
|
linestring: CrEOF\Spatial\DBAL\Types\Geometry\LineStringType
|
||||||
multipolygon: CrEOF\Spatial\DBAL\Types\Geometry\MultiPolygonType
|
|
||||||
|
|
||||||
|
|
||||||
orm:
|
orm:
|
||||||
default_entity_manager: default
|
|
||||||
auto_generate_proxy_classes: '%kernel.debug%'
|
auto_generate_proxy_classes: '%kernel.debug%'
|
||||||
entity_managers:
|
|
||||||
logging:
|
|
||||||
connection: logging
|
|
||||||
naming_strategy: doctrine.orm.naming_strategy.underscore
|
|
||||||
mappings:
|
|
||||||
Log:
|
|
||||||
is_bundle: false
|
|
||||||
type: annotation
|
|
||||||
dir: '%kernel.project_dir%/src/Entity/Logging'
|
|
||||||
prefix: 'App\Entity\Logging'
|
|
||||||
alias: Log
|
|
||||||
default:
|
|
||||||
connection: default
|
|
||||||
naming_strategy: doctrine.orm.naming_strategy.underscore
|
naming_strategy: doctrine.orm.naming_strategy.underscore
|
||||||
auto_mapping: true
|
auto_mapping: true
|
||||||
mappings:
|
mappings:
|
||||||
|
|
|
||||||
|
|
@ -1,107 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Entity\Logging;
|
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
|
||||||
|
|
||||||
use DateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Entity
|
|
||||||
* @ORM\Table(name="entity_log")
|
|
||||||
*/
|
|
||||||
class EntityLog
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @ORM\Id
|
|
||||||
* @ORM\Column(type="integer")
|
|
||||||
* @ORM\GeneratedValue(strategy="AUTO")
|
|
||||||
*/
|
|
||||||
protected $id;
|
|
||||||
|
|
||||||
// user that executed the action
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="string", length=80)
|
|
||||||
* @Assert\NotBlank()
|
|
||||||
*/
|
|
||||||
protected $user;
|
|
||||||
|
|
||||||
// date action took place
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="datetime")
|
|
||||||
*/
|
|
||||||
protected $date_action;
|
|
||||||
|
|
||||||
// action
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="string", length=80)
|
|
||||||
* @Assert\NotBlank()
|
|
||||||
*/
|
|
||||||
protected $action;
|
|
||||||
|
|
||||||
// changes
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="json")
|
|
||||||
*/
|
|
||||||
protected $changes;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->changes = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getID()
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUser()
|
|
||||||
{
|
|
||||||
return $this->user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setUser(string $user)
|
|
||||||
{
|
|
||||||
$this->user = $user;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDateAction()
|
|
||||||
{
|
|
||||||
return $this->date_action;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setDateAction(DateTime $date_action)
|
|
||||||
{
|
|
||||||
$this->date_action = $date_action;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAction()
|
|
||||||
{
|
|
||||||
return $this->action;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setAction(string $action)
|
|
||||||
{
|
|
||||||
$this->action = $action;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getChanges($id)
|
|
||||||
{
|
|
||||||
// return null if we don't have it
|
|
||||||
if (!isset($this->changes[$id]))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return $this->changes[$id];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addChange($id, $value)
|
|
||||||
{
|
|
||||||
$this->changes[$id] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue