Exemple #1
0
 /**
  * @see models_ClassGenerator_Defaults_Interface::createMethodIsSaved
  */
 public function createMethodIsSaved()
 {
     $resultMethod = new Zend_CodeGenerator_Php_Method();
     $resultMethod->setName('save');
     $resultMethod->setVisibility(Zend_CodeGenerator_Php_Property::VISIBILITY_PUBLIC);
     $saArray = $this->getPersistenceInformation()->getSerialAttributes();
     if (!empty($saArray)) {
         foreach ($saArray as $serialAttribute) {
             /* @var $serialAttribute Zend_CodeGenerator_Php_Property */
             $body .= 'if($this->$' . $serialAttribute->getName() . '!== null){' . "\n";
             $body .= "\t" . 'return false;' . "\n";
             $body .= '}' . "\n";
         }
     }
     $body .= 'return true;';
     $resultMethod->setBody($body);
     $docblock = new Zend_CodeGenerator_Php_Docblock();
     $docblock->setShortDescription('Returns true if the object is saved (must not be current state) persistent in the database.');
     $docblock->setTags(array('return', Zend_CodeGenerator_Php_Property_DefaultValue::TYPE_BOOL));
     $resultMethod->setDocblock($docblock);
     $this->getClass()->setMethod($resultMethod);
 }
 public function testShortDescriptionGetterAndSetter()
 {
     $this->_docblock->setShortDescription('Short Description');
     $this->assertEquals('Short Description', $this->_docblock->getShortDescription());
 }