xeonist

Frame.php

Nov 10th, 2011
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.34 KB | None | 0 0
  1. <?php
  2. // src/Dessin/PlanBundle/Entity/Frame.php
  3. namespace Dessin\PlanBundle\Entity;
  4.  
  5. use Doctrine\DBAL\Types\StringType;
  6.  
  7. use Doctrine\DBAL\Types\IntegerType;
  8.  
  9. use Doctrine\DBAL\Types\BooleanType;
  10.  
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Doctrine\Common\Collections\ArrayCollection;
  13. //use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
  14. use Symfony\Component\Validator\Constraints as Assert;
  15.  
  16. /**
  17. * @ORM\Entity
  18. * @ORM\Table(name="Frame")
  19. */
  20. class Frame
  21. {
  22.  
  23.     /**
  24.     * @ORM\Id
  25.     * @ORM\Column(type="integer")
  26.     * @ORM\GeneratedValue(strategy="AUTO")
  27.     *
  28.     * @var integer $id
  29.     */
  30.     protected $id;
  31.    
  32.     /**
  33.     * @ORM\Column(type="integer")
  34.     *
  35.     * @var integer type
  36.     */
  37.     protected $type;
  38.    
  39.     /**
  40.     * @ORM\Column(type="boolean")
  41.     *
  42.     * @var boolean margin
  43.     */
  44.     protected $margin;
  45.    
  46.     /**
  47.     * @ORM\Column(type="float", nullable=true)
  48.     *
  49.     * @var float marginH
  50.     */
  51.     protected $marginH;
  52.    
  53.     /**
  54.     * @ORM\Column(type="float", nullable=true)
  55.     *
  56.     * @var float marginV
  57.     */
  58.     protected $marginV;
  59.    
  60.     /**
  61.     * @ORM\Column(type="boolean")
  62.     *
  63.     * @var boolean title
  64.     */
  65.     protected $title;
  66.    
  67.     /**
  68.      * @ORM\Column(type="string", nullable=true)
  69.      *
  70.      * @var string locality
  71.      */
  72.     protected $locality;
  73.    
  74.     /**
  75.     * @ORM\Column(type="boolean")
  76.     *
  77.     * @var boolean cartridge
  78.     */
  79.     protected $cartridge;
  80.    
  81.     /**
  82.      * @ORM\Column(type="float", nullable=true)
  83.      *
  84.      * @var string cartridgeV
  85.      */
  86.     protected $cartridgeV;
  87.    
  88.     /**
  89.     * @ORM\Column(type="float", nullable=true)
  90.     *
  91.     * @var string cartridgeH
  92.     */
  93.     protected $cartridgeH;
  94.    
  95.    
  96.     /*
  97.     /**
  98.      * @ORM\OneToOne(targetEntity="Notice")
  99.      */
  100.     /*protected $notice;*/
  101.    
  102. //* @ORM\ManyToOne(targetEntity="Notice", inversedBy="frames", cascade={"persist"})
  103.     /**
  104.     * @ORM\ManyToOne(targetEntity="Notice", inversedBy="frames")
  105.     * @ORM\JoinColumn(name="notice_id", referencedColumnName="id", nullable=true)
  106.     *
  107.     */
  108.     protected $notice;
  109.    
  110.    
  111.     /**
  112.     * @ORM\Column(type="boolean")
  113.     *
  114.     * @var boolean foldMark
  115.     */
  116.     protected $foldMark;
  117.    
  118.     /**
  119.     * @ORM\Column(type="boolean")
  120.     *
  121.     * @var boolean scale
  122.     */
  123.     protected $scale;
  124.    
  125.     /**
  126.     * @ORM\Column(type="float", nullable=true)
  127.     *
  128.     * @var float scaleLength
  129.     */
  130.     protected $scaleLength;
  131.    
  132.     /**
  133.     * @ORM\Column(type="integer", nullable=true)
  134.     *
  135.     * @var integer scaleSubdivisions
  136.     */
  137.     protected $scaleSubdivisions;
  138.    
  139.  
  140.     /**
  141.      * Get id
  142.      *
  143.      * @return integer
  144.      */
  145.     public function getId()
  146.     {
  147.         return $this->id;
  148.     }
  149.  
  150.     /**
  151.      * Set type
  152.      *
  153.      * @param integer $type
  154.      */
  155.     public function setType($type)
  156.     {
  157.         $this->type = $type;
  158.     }
  159.  
  160.     /**
  161.      * Get type
  162.      *
  163.      * @return integer
  164.      */
  165.     public function getType()
  166.     {
  167.         return $this->type;
  168.     }
  169.  
  170.     /**
  171.      * Set margin
  172.      *
  173.      * @param boolean $margin
  174.      */
  175.     public function setMargin($margin)
  176.     {
  177.         $this->margin = $margin;
  178.     }
  179.  
  180.     /**
  181.      * Get margin
  182.      *
  183.      * @return boolean
  184.      */
  185.     public function getMargin()
  186.     {
  187.         return $this->margin;
  188.     }
  189.  
  190.     /**
  191.      * Set marginH
  192.      *
  193.      * @param float $marginH
  194.      */
  195.     public function setMarginH($marginH)
  196.     {
  197.         $this->marginH = $marginH;
  198.     }
  199.  
  200.     /**
  201.      * Get marginH
  202.      *
  203.      * @return float
  204.      */
  205.     public function getMarginH()
  206.     {
  207.         return $this->marginH;
  208.     }
  209.  
  210.     /**
  211.      * Set marginV
  212.      *
  213.      * @param float $marginV
  214.      */
  215.     public function setMarginV($marginV)
  216.     {
  217.         $this->marginV = $marginV;
  218.     }
  219.  
  220.     /**
  221.      * Get marginV
  222.      *
  223.      * @return float
  224.      */
  225.     public function getMarginV()
  226.     {
  227.         return $this->marginV;
  228.     }
  229.  
  230.     /**
  231.      * Set title
  232.      *
  233.      * @param boolean $title
  234.      */
  235.     public function setTitle($title)
  236.     {
  237.         $this->title = $title;
  238.     }
  239.  
  240.     /**
  241.      * Get title
  242.      *
  243.      * @return boolean
  244.      */
  245.     public function getTitle()
  246.     {
  247.         return $this->title;
  248.     }
  249.  
  250.     /**
  251.      * Set locality
  252.      *
  253.      * @param string $locality
  254.      */
  255.     public function setLocality($locality)
  256.     {
  257.         $this->locality = $locality;
  258.     }
  259.  
  260.     /**
  261.      * Get locality
  262.      *
  263.      * @return string
  264.      */
  265.     public function getLocality()
  266.     {
  267.         return $this->locality;
  268.     }
  269.  
  270.     /**
  271.      * Set cartridge
  272.      *
  273.      * @param boolean $cartridge
  274.      */
  275.     public function setCartridge($cartridge)
  276.     {
  277.         $this->cartridge = $cartridge;
  278.     }
  279.  
  280.     /**
  281.      * Get cartridge
  282.      *
  283.      * @return boolean
  284.      */
  285.     public function getCartridge()
  286.     {
  287.         return $this->cartridge;
  288.     }
  289.  
  290.     /**
  291.      * Set cartridgeV
  292.      *
  293.      * @param float $cartridgeV
  294.      */
  295.     public function setCartridgeV($cartridgeV)
  296.     {
  297.         $this->cartridgeV = $cartridgeV;
  298.     }
  299.  
  300.     /**
  301.      * Get cartridgeV
  302.      *
  303.      * @return float
  304.      */
  305.     public function getCartridgeV()
  306.     {
  307.         return $this->cartridgeV;
  308.     }
  309.  
  310.     /**
  311.      * Set cartridgeH
  312.      *
  313.      * @param float $cartridgeH
  314.      */
  315.     public function setCartridgeH($cartridgeH)
  316.     {
  317.         $this->cartridgeH = $cartridgeH;
  318.     }
  319.  
  320.     /**
  321.      * Get cartridgeH
  322.      *
  323.      * @return float
  324.      */
  325.     public function getCartridgeH()
  326.     {
  327.         return $this->cartridgeH;
  328.     }
  329.  
  330.     /**
  331.      * Set foldMark
  332.      *
  333.      * @param boolean $foldMark
  334.      */
  335.     public function setFoldMark($foldMark)
  336.     {
  337.         $this->foldMark = $foldMark;
  338.     }
  339.  
  340.     /**
  341.      * Get foldMark
  342.      *
  343.      * @return boolean
  344.      */
  345.     public function getFoldMark()
  346.     {
  347.         return $this->foldMark;
  348.     }
  349.  
  350.     /**
  351.      * Set scale
  352.      *
  353.      * @param boolean $scale
  354.      */
  355.     public function setScale($scale)
  356.     {
  357.         $this->scale = $scale;
  358.     }
  359.  
  360.     /**
  361.      * Get scale
  362.      *
  363.      * @return boolean
  364.      */
  365.     public function getScale()
  366.     {
  367.         return $this->scale;
  368.     }
  369.  
  370.     /**
  371.      * Set scaleLength
  372.      *
  373.      * @param float $scaleLength
  374.      */
  375.     public function setScaleLength($scaleLength)
  376.     {
  377.         $this->scaleLength = $scaleLength;
  378.     }
  379.  
  380.     /**
  381.      * Get scaleLength
  382.      *
  383.      * @return float
  384.      */
  385.     public function getScaleLength()
  386.     {
  387.         return $this->scaleLength;
  388.     }
  389.  
  390.     /**
  391.      * Set scaleSubdivisions
  392.      *
  393.      * @param integer $scaleSubdivisions
  394.      */
  395.     public function setScaleSubdivisions($scaleSubdivisions)
  396.     {
  397.         $this->scaleSubdivisions = $scaleSubdivisions;
  398.     }
  399.  
  400.     /**
  401.      * Get scaleSubdivisions
  402.      *
  403.      * @return integer
  404.      */
  405.     public function getScaleSubdivisions()
  406.     {
  407.         return $this->scaleSubdivisions;
  408.     }
  409.  
  410.    
  411.     /**
  412.     * Set notice
  413.     *
  414.     * @param Dessin\PlanBundle\Entity\Notice $notice
  415.     */
  416.     public function setNotice(\Dessin\PlanBundle\Entity\Notice $notice = NULL)
  417.     {
  418.         $this->notice = $notice;
  419.     }
  420.    
  421.     /**
  422.      * Get notice
  423.      *
  424.      * @return Dessin\PlanBundle\Entity\Notice
  425.      */
  426.     public function getNotice()
  427.     {
  428.         return $this->notice;
  429.     }
  430.    
  431.    
  432.     public function __construct(){
  433.         $this->title = false;
  434.         $this->cartridge = false;
  435.         $this->foldMark = false;
  436.         $this->scale = false;
  437.     }
  438.    
  439.     /**
  440.      * force margin properties when margin checkbox is ticked
  441.      *
  442.      * @Assert\True(message = "margin.is.enabled.but.margin.properties.are.not.filled.")
  443.      */
  444.     public function isMarginFilledProperly()
  445.     {
  446.         return ( !$this->margin || ( $this->margin && isset($this->marginH) && isset($this->marginV) ) );
  447.     }
  448.    
  449.    
  450.  
  451.     /**
  452.     * force cartridge properties when cartridge checkbox is ticked
  453.     *
  454.     * @Assert\True(message = "cartridge.is.enabled.but.its.properties.are.not.filled.")
  455.     */
  456.     public function isCartridgeFilledProperly()
  457.     {
  458.         return ( !$this->cartridge || ( $this->cartridge && isset($this->cartridgeH) && isset($this->cartridgeV) ) );
  459.     }
  460.    
  461.    
  462.     /**
  463.     * force scale properties when scale checkbox is ticked
  464.     *
  465.     * @Assert\True(message = "scale.is.enabled.but.its.properties.are.not.filled.")
  466.     */
  467.     public function isScaleFilledProperly()
  468.     {
  469.         return ( !$this->scale || ( $this->scale && isset($this->scaleLength) && isset($this->scaleSubdivisions) ) );
  470.     }
  471.    
  472. }
  473.  
Advertisement
Add Comment
Please, Sign In to add comment