Field.php 1.44 KiB
<?php
/*
 * © 2016 IRSTEA
 * Guillaume Perréal <guillaume.perreal@irstea.fr>
 * Tous droits réservés.
 */
namespace Irstea\PlantUmlBundle\Doctrine;
use Irstea\PlantUmlBundle\Model\Node\Member\Member;
use Irstea\PlantUmlBundle\Writer\WriterInterface;
/**
 * Description of Field
 * @author Guillaume Perréal <guillaume.perreal@irstea.fr>
class Field extends Member
    /**
     * @var boolean
    private $isUnique;
    /**
     * @var boolean
    private $isNullable;
    /**
     * @var boolean
    private $isIdentifier;
    public function __construct($symbol, $type, $isUnique = false, $isNullable = false, $isIdentifier = false)
        parent::__construct($symbol, $type);
        $this->isUnique     = $isUnique;
        $this->isNullable   = $isNullable;
        $this->isIdentifier = $isIdentifier;
    protected function writeSymbolTo(WriterInterface $writer)
        if ($this->isIdentifier) {
            $writer->write('<b>');
        if (!$this->isNullable) {
            $writer->write('<i>');
        if ($this->isUnique) {
            $writer->write('<u>');
        parent::writeSymbolTo($writer);
        if ($this->isUnique) {
            $writer->write('</u>');
        if (!$this->isNullable) {
            $writer->write('</i>');
        if ($this->isIdentifier) {
            $writer->write('</b>');
        return $this;