Overview

Namespaces

  • Mapbender
    • Component
      • HTTP
    • CoreBundle
      • Command
      • Component
        • Exception
      • Controller
      • DataFixtures
        • ORM
      • DependencyInjection
      • Element
        • Type
      • Entity
      • EventListener
      • Extension
      • Form
        • DataTransformer
        • EventListener
        • Type
      • Security
      • Template
    • DrupalIntegrationBundle
      • DependencyInjection
      • Security
        • Authentication
          • Provider
          • Token
        • Authorization
          • Voter
        • Factory
        • Firewall
        • User
      • Session
    • KmlBundle
      • Element
    • ManagerBundle
      • Controller
      • Form
        • DataTransformer
        • Type
    • MonitoringBundle
      • Command
      • Component
      • Controller
      • DependencyInjection
      • Entity
      • EventListener
      • Form
    • PrintBundle
      • Component
      • Controller
    • WmcBundle
      • Component
        • Exception
      • Element
        • Type
      • Entity
      • Form
        • EventListener
        • Type
    • WmsBundle
      • Component
        • Exception
      • Controller
      • DependencyInjection
      • Element
        • Type
      • Entity
      • Event
      • Form
        • EventListener
        • Type
    • WmtsBundle
      • Component
        • Exception
      • Controller
      • Entity
      • Form
        • Type
  • None
  • PHP

Classes

  • Application
  • Contact
  • Element
  • Keyword
  • Layerset
  • Source
  • SourceInstance
  • SRS
  • State
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
  1: <?php
  2: 
  3: /**
  4:  * TODO: License
  5:  */
  6: 
  7: namespace Mapbender\CoreBundle\Entity;
  8: 
  9: use Doctrine\ORM\Mapping as ORM;
 10: use Doctrine\Common\Collections\ArrayCollection;
 11: use Doctrine\ORM\Mapping\UniqueConstraint;
 12: use Symfony\Component\Validator\Constraints as Assert;
 13: use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
 14: 
 15: /**
 16:  * Layerset configuration entity
 17:  *
 18:  * @author Christian Wygoda
 19:  *
 20:  * @ORM\Entity
 21:  * @ORM\Table(name="mb_core_layerset",uniqueConstraints={@UniqueConstraint(name="layerset_idx", columns={"application_id", "title"})})
 22:  * @UniqueEntity(fields={"application", "title"}, message ="Duplicate entry for key 'title'.")
 23:  */
 24: class Layerset
 25: {
 26: 
 27:     /**
 28:      * @var integer $id
 29:      * @ORM\Id
 30:      * @ORM\Column(type="integer")
 31:      * @ORM\GeneratedValue(strategy="AUTO")
 32:      */
 33:     protected $id;
 34: 
 35:     /**
 36:      * @var string $title The layerset title
 37:      * @ORM\Column(type="string", length=128)
 38:      * @Assert\NotBlank()
 39:      */
 40:     protected $title;
 41: 
 42:     /**
 43:      * @var Application The configuration entity for the application
 44:      * @ORM\ManyToOne(targetEntity="Application", inversedBy="layersets")
 45:      */
 46:     protected $application;
 47: 
 48:     /**
 49:      * @ORM\OneToMany(targetEntity="SourceInstance", mappedBy="layerset", cascade={"refresh","persist", "remove"})
 50:      * @ORM\JoinColumn(name="instances", referencedColumnName="id")
 51:      * @ORM\OrderBy({"weight" = "asc"})
 52:      */
 53:     protected $instances;
 54: 
 55:     public function __construct()
 56:     {
 57:         $this->instances = new ArrayCollection();
 58:     }
 59: 
 60:     /**
 61:      * Set id. DANGER
 62:      *
 63:      * Set the entity id. DO NOT USE THIS unless you know what you're doing.
 64:      * Probably the only place where this should be used is in the
 65:      * ApplicationYAMLMapper class. Maybe this could be done using a proxy
 66:      * class instead?
 67:      */
 68:     public function setId($id)
 69:     {
 70:         if(null !== $id) {
 71:             $this->id = $id;
 72:         }
 73:         return $this;
 74:     }
 75: 
 76:     /**
 77:      * Get id
 78:      *
 79:      * @return integer
 80:      */
 81:     public function getId()
 82:     {
 83:         return $this->id;
 84:     }
 85: 
 86:     /**
 87:      * Set title
 88:      *
 89:      * @param string $title
 90:      */
 91:     public function setTitle($title)
 92:     {
 93:         $this->title = $title;
 94:         return $this;
 95:     }
 96: 
 97:     /**
 98:      * Get title
 99:      *
100:      * @return string
101:      */
102:     public function getTitle()
103:     {
104:         return $this->title;
105:     }
106: 
107:     /**
108:      * Set application
109:      *
110:      * @param Application $application
111:      */
112:     public function setApplication(Application $application)
113:     {
114:         $this->application = $application;
115:         return $this;
116:     }
117: 
118:     /**
119:      * Get application
120:      *
121:      * @return Application
122:      */
123:     public function getApplication()
124:     {
125:         return $this->application;
126:     }
127: 
128:     /**
129:      * Add SourceInstance
130:      *
131:      * @param SourceInstance $instance
132:      */
133:     public function addInstance(SourceInstance $instance)
134:     {
135:         $this->instances->add($instance);
136:     }
137: 
138:     /**
139:      * Set instances
140:      *
141:      * @param Doctrine\Common\Collections\Collection $instances
142:      * Collection of the SourceInstances
143:      * @return Layerset
144:      */
145:     public function setInstances($instances)
146:     {
147:         $this->instances = $instances;
148:         return $this;
149:     }
150: 
151:     /**
152:      * Get instances
153:      *
154:      * @return Doctrine\Common\Collections\Collection
155:      */
156:     public function getInstances()
157:     {
158:         return $this->instances;
159:     }
160: 
161:     public function __toString()
162:     {
163:         return (string) $this->getId();
164:     }
165: 
166: }
167: 
168: 
Mapbender3 API documenation API documentation generated by ApiGen 2.8.0