예제 #1
0
 /**
  * add all setter/getter/add/remove etc. methods
  * @param \EBT\ExtensionBuilder\Domain\Model\DomainObject\AbstractProperty $domainProperty
  *
  * @return void
  */
 protected function setPropertyRelatedMethods($domainProperty)
 {
     if ($domainProperty->isAnyToManyRelation()) {
         $addMethod = $this->buildAddMethod($domainProperty);
         $removeMethod = $this->buildRemoveMethod($domainProperty);
         $this->classObject->setMethod($addMethod);
         $this->classObject->setMethod($removeMethod);
     }
     $getMethod = $this->buildGetterMethod($domainProperty);
     $setMethod = $this->buildSetterMethod($domainProperty);
     $this->classObject->setMethod($getMethod);
     $this->classObject->setMethod($setMethod);
     if (strpos($domainProperty->getTypeForComment(), 'bool') === 0) {
         $isMethod = $this->buildIsMethod($domainProperty);
         $this->classObject->setMethod($isMethod);
     }
 }
예제 #2
0
 /**
  *
  * @param \EBT\ExtensionBuilder\Domain\Model\DomainObject\AbstractProperty $oldProperty
  * @param \EBT\ExtensionBuilder\Domain\Model\DomainObject\AbstractProperty $newProperty
  *
  * @return void
  */
 protected function updatePropertyRelatedMethods($oldProperty, $newProperty)
 {
     if ($newProperty->isAnyToManyRelation()) {
         $this->updateMethod($oldProperty, $newProperty, 'add');
         $this->updateMethod($oldProperty, $newProperty, 'remove');
     }
     $this->updateMethod($oldProperty, $newProperty, 'get');
     $this->updateMethod($oldProperty, $newProperty, 'set');
     if ($newProperty->isBoolean()) {
         $this->updateMethod($oldProperty, $newProperty, 'is');
     }
     if ($newProperty->getTypeForComment() != $this->updateExtensionKey($oldProperty->getTypeForComment())) {
         if ($oldProperty->isBoolean() && !$newProperty->isBoolean()) {
             $this->classObject->removeMethod(ClassBuilder::getMethodName($oldProperty, 'is'));
             $this->log('Method removed:' . ClassBuilder::getMethodName($oldProperty, 'is'), 1, $this->classObject->getMethods());
         }
     }
 }