Exemple #1
0
 /**
  * @param \EBT\ExtensionBuilder\Domain\Model\DomainObject\AbstractProperty $domainProperty
  * @param string $methodType
  * @return string
  */
 public static function getParamTag(AbstractProperty $domainProperty, $methodType)
 {
     switch ($methodType) {
         case 'set':
             return $domainProperty->getTypeForComment() . ' $' . $domainProperty->getName();
         case 'add':
             /** @var $domainProperty \EBT\ExtensionBuilder\Domain\Model\DomainObject\Relation\AbstractRelation */
             $paramTag = $domainProperty->getForeignClassName();
             $paramTag .= ' $' . self::getParameterName($domainProperty, 'add');
             return $paramTag;
         case 'remove':
             /** @var $domainProperty \EBT\ExtensionBuilder\Domain\Model\DomainObject\Relation\AbstractRelation */
             $paramTag = $domainProperty->getForeignClassName();
             $paramTag .= ' $' . self::getParameterName($domainProperty, 'remove');
             $paramTag .= ' The ' . $domainProperty->getForeignModelName() . ' to be removed';
             return $paramTag;
     }
 }
Exemple #2
0
 /**
  * @param \EBT\ExtensionBuilder\Domain\Model\DomainObject\AbstractProperty $property
  *
  * @return void
  */
 public function addProperty(DomainObject\AbstractProperty $property)
 {
     $property->setDomainObject($this);
     if ($property->getNeedsUploadFolder()) {
         $this->needsUploadFolder = TRUE;
     }
     $this->properties[] = $property;
 }
Exemple #3
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());
         }
     }
 }