コード例 #1
0
 /**
  * Builds a method that checks the current boolean state of a property
  *
  * @param Tx_ExtensionBuilder_Domain_Model_DomainObject_AbstractProperty $domainProperty
  *
  * @return Tx_ExtensionBuilder_Domain_Model_Class_Method
  */
 protected function buildIsMethod($domainProperty)
 {
     $isMethodName = $this->getMethodName($domainProperty, 'is');
     if ($this->classObject->methodExists($isMethodName)) {
         $isMethod = $this->classObject->getMethod($isMethodName);
         //t3lib_div::devlog('Existing isMethod imported:' . $isMethodName, 'extension_builder', 0, array('methodBody' => $isMethod->getBody()));
     } else {
         //t3lib_div::devlog('new isMethod:' . $isMethodName, 'extension_builder', 1);
         $isMethod = new Tx_ExtensionBuilder_Domain_Model_Class_Method($isMethodName);
         // default method body
         $isMethod->setBody($this->codeGenerator->getDefaultMethodBody(NULL, $domainProperty, 'Model', 'is', ''));
         $isMethod->setTag('return', 'boolean');
         $isMethod->addModifier('public');
     }
     if (!$isMethod->hasDescription()) {
         $isMethod->setDescription('Returns the boolean state of ' . $domainProperty->getName());
     }
     return $isMethod;
 }