Skip to content

Instantly share code, notes, and snippets.

@apathyboy
Created April 8, 2011 23:29
Show Gist options
  • Select an option

  • Save apathyboy/910931 to your computer and use it in GitHub Desktop.

Select an option

Save apathyboy/910931 to your computer and use it in GitHub Desktop.
<?php
namespace Sub6\PilotNocBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @orm:Entity
* @orm:Table(name="server")
*/
class Server
{
/**
* Unique identifier for the server.
*
* @var int
*
* @orm:Id
* @orm:Column(type="integer")
* @orm:generatedValue
*/
protected $id;
/**
* FQDN for the server.
*
* @var string
*
* @orm:Column
*/
protected $hostname;
/**
* Often multiple server's are used for common tasks. By assigning a category
* to a server it is easy to group servers together as well as provide additional
* Attributes common to each server in a category.
*
* @var \Doctrine\Common\Collections\ArrayCollection
*
* @orm:ManyToMany(targetEntity="Category")
* @orm:JoinTable(name="servers_categories",
* joinColumns={@orm:JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@orm:JoinColumn(name="category_id", referencedColumnName="id")})
*/
protected $categories;
/**
* Attributes are individual pieces of data stored for server. Attributes
* provide a way to create new data fields and add them to servers or Categories,
* making it much easier to customize what information is tracked for a server.
*
* @var \Doctrine\Common\Collections\ArrayCollection
*
* @orm:ManyToMany(targetEntity="Attribute")
* @orm:JoinTable(name="servers_attributes",
* joinColumns={@orm:JoinColumn(name="server_id", referencedColumnName="id")},
* inverseJoinColumns={@orm:JoinColumn(name="attribute_id", referencedColumnName="id", unique=true)})
*/
protected $attributes;
/**
* Constructor for the Server class.
*/
public function __construct()
{
$this->categories = new ArrayCollection();
$this->attributes = new ArrayCollection();
}
/**
* Returns the FQDN for the server.
*
* @return string
*/
public function getHostname()
{
return $this->hostname;
}
/**
* Sets a new FQDN for the server.
*
* @param string $hostname
* @return void
*/
public function setHostname($hostname)
{
$this->hostname = $hostname;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment