public function getNamespace()
 {
     if ($namespace = parent::getNamespace()) {
         if ($this->getGeneratorConfig() && ($omns = $this->getGeneratorConfig()->getBuildProperty('namespaceOm'))) {
             return $namespace . '\\' . $omns;
         } else {
             return $namespace;
         }
     }
 }
Example #2
0
 /**
  * Uses a builder class to create the output class.
  * This method assumes that the DataModelBuilder class has been initialized with the build properties.
  * @param      OMBuilder $builder
  * @param      boolean $overwrite Whether to overwrite existing files with te new ones (default is YES).
  * @todo       -cPropelOMTask Consider refactoring build() method into AbstractPropelDataModelTask (would need to be more generic).
  */
 protected function build(OMBuilder $builder, $overwrite = true)
 {
     $path = $builder->getClassFilePath();
     $this->ensureDirExists(dirname($path));
     $_f = new PhingFile($this->getOutputDirectory(), $path);
     // skip files already created once
     if ($_f->exists() && !$overwrite) {
         $this->log("\t-> (exists) " . $builder->getClassFilePath(), Project::MSG_VERBOSE);
         return 0;
     }
     $script = $builder->build();
     foreach ($builder->getWarnings() as $warning) {
         $this->log($warning, Project::MSG_WARN);
     }
     // skip unchanged files
     if ($_f->exists() && $script == $_f->contents()) {
         $this->log("\t-> (unchanged) " . $builder->getClassFilePath(), Project::MSG_VERBOSE);
         return 0;
     }
     // write / overwrite new / changed files
     $action = $_f->exists() ? 'Updating' : 'Creating';
     $this->log(sprintf("\t-> %s %s (table: %s, builder: %s)", $action, $builder->getClassFilePath(), $builder->getTable()->getName(), get_class($builder)));
     file_put_contents($_f->getAbsolutePath(), $script);
     return 1;
 }
Example #3
0
 /**
  * Checks whether any registered behavior on that table has a modifier for a hook
  * @param string $hookName The name of the hook as called from one of this class methods, e.g. "preSave"
  * @return boolean
  */
 public function hasBehaviorModifier($hookName, $modifier = null)
 {
     return parent::hasBehaviorModifier($hookName, 'QueryBuilderModifier');
 }
 public static function getRefRelatedBySuffix(ForeignKey $fk)
 {
     return parent::getRefRelatedBySuffix($fk);
 }
 public function getPackage()
 {
     return parent::getPackage();
 }
 /**
  * Gets the package for the [base] object classes.
  * @return     string
  */
 public function getPackage()
 {
     return $this->getChild()->getPackage() ? $this->getChild()->getPackage() : parent::getPackage();
 }