/**
  * Generates the code for the object, which extends the base object.
  *
  * @param string $name The object's name.
  *
  * @return string The PHP code.
  *
  * @author Ralf Schubert
  * @version 0.1,  15.01.2011<br />
  */
 protected function generateObjectCode($name)
 {
     $class = $this->domainObjectsTable[$name]['Class'];
     $className = RootClassLoader::getClassName($class);
     return '/**' . PHP_EOL . ' * This class represents the "' . $class . '" domain object.' . PHP_EOL . ' * <p/>' . PHP_EOL . ' * Please use this class to add your own functionality.' . PHP_EOL . ' */' . PHP_EOL . 'class ' . $className . ' extends ' . $className . 'Base {' . PHP_EOL . PHP_EOL . '   /**' . PHP_EOL . '    * Call the parent\'s constructor because the object name needs to be set.' . PHP_EOL . '    * <p/>' . PHP_EOL . '    * To create an instance of this object, just call' . PHP_EOL . '    * <code>' . PHP_EOL . '    * use ' . $class . ';' . PHP_EOL . '    * $object = new ' . $className . '();' . PHP_EOL . '    * </code>' . PHP_EOL . '    *' . PHP_EOL . '    * @param string $objectName The internal object name of the domain object.' . PHP_EOL . '    */' . PHP_EOL . '   public function __construct($objectName = null) {' . PHP_EOL . '      parent::__construct();' . PHP_EOL . '   }' . PHP_EOL . PHP_EOL . '}';
 }
Ejemplo n.º 2
0
 public function testGetClassName()
 {
     $this->assertEquals('StandardClassLoader', RootClassLoader::getClassName('APF\\core\\loader\\StandardClassLoader'));
     $this->assertEquals('StandardClassLoader', RootClassLoader::getClassName('APF\\StandardClassLoader'));
 }