示例#1
0
 /**
  *
  * @param WS_Model_Xml_Property $p
  * @throws WS_Model_Xml_Property On dublicate property names.
  */
 public function addProperty(WS_Model_Xml_Property $p)
 {
     if ($this->hasProperty($p->getName())) {
         throw new InvalidArgumentException("Property with name '{$p->getName()}' allready added to the entity!");
     }
     $this->properties[$p->getName()] = $p;
 }
 /**
  * Generates getter method for a given property.
  *
  * @param WS_Model_Xml_Property $property The property used to generate the getter for.
  *
  * @return WS_Model_Template_Method
  */
 protected function generateGetterMethod(WS_Model_Xml_Property $property)
 {
     $methodName = WS_Model_AbstractBase::generateGetterName($property->getName());
     $methodTpl = $this->generateMethod($methodName, WS_Model_Template_Abstract::MODIFIER_PUBLIC);
     $body = "return \$this->{$property->getName()};";
     $methodTpl->setBody($body);
     return $methodTpl;
 }