mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-28 20:50:06 +02:00
Check read property on part entity objects.
This commit is contained in:
parent
44bad9029b
commit
3ecbe19fd6
7 changed files with 98 additions and 26 deletions
|
@ -29,6 +29,7 @@
|
|||
|
||||
namespace App\Security\Annotations;
|
||||
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use Doctrine\Common\Annotations\Annotation;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use \InvalidArgumentException;
|
||||
|
@ -90,10 +91,25 @@ class ColumnSecurity
|
|||
|
||||
public function getPlaceholder()
|
||||
{
|
||||
//Check if a class name was specified
|
||||
if (class_exists($this->type)) {
|
||||
$object = new $this->type();
|
||||
if ($object instanceof NamedDBElement) {
|
||||
if (is_string($this->placeholder) && $this->placeholder !== "") {
|
||||
$object->setName($this->placeholder);
|
||||
}
|
||||
$object->setName('???');
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
||||
if (null === $this->placeholder) {
|
||||
switch ($this->type) {
|
||||
case 'integer':
|
||||
return 0;
|
||||
case 'float':
|
||||
return 0.0;
|
||||
case 'string':
|
||||
return '???';
|
||||
case 'object':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue