ezsystems/ezp-next — comment on commit 8b75b1b8a05bdcb44be2f37a69a25e07d9ad124e
File:  line 0
By andrerom:

1. Don't think there is a need to have the constant defined in config.php, it is already defined by the one in bootstrap.php.
So maybe just have some text explaining how to set it like the one you have in comment just above this one.

2. The change of format on repositories path (eg: API_ROOT_FOLDER . '/ezp' ) is also debatable, checked all use of it?

3. Also if possible, it would be great to avoid force use of the new constant, needs some fine tuning but something like this could maybe work:

```php
diff --git a/config.php-RECOMMENDED b/config.php-RECOMMENDED
index 0e2030c..821976f 100644
--- a/config.php-RECOMMENDED
+++ b/config.php-RECOMMENDED
@@ -29,6 +29,18 @@ error_reporting ( E_ALL | E_STRICT );
// Optional: increases accuracy of timers and accumulators @todo If not set, then don't capture timers/accumulators?
//$_SERVER['REQUEST_MICRO_TIME'] = microtime( true );

+// API_ROOT_FOLDER is a optional constant containing path to ezp-next folder.
+// Defining it can be useful in order to have it wrapped in an eZ Publish extension
+// as it will make autoloading work seamlessly.
+// For instance, if you want to embed API into an extension named "ezpnext", you should do :
+// define( 'API_ROOT_FOLDER', 'extension/ezpnext/' ); // Trailing slash is important here
+// require API_ROOT_FOLDER . 'bootstrap.php';
+
+if ( defined( 'API_ROOT_FOLDER' ) )
+ $ezpNextPath = API_ROOT_FOLDER;
+else
+ $ezpNextPath = '';
+
// Required: Settings bellow are runtime settings that needs to be set here, you can
// optionally also override any other setting here.
$settings = array(
@@ -44,8 +56,9 @@ $settings = array(
'ezc-src-path' => '/', // pear

// Hash with class name prefix and folder name, needed for autoload system as well as router
- 'repositories' => array( 'ezp' => 'ezp',
- 'ezx' => 'ezx' ),
+ // folder name is relative to api root folder, and is prepended with ezp-next-path
+ 'repositories' => array( 'ezp' => "{$ezpNextPath}ezp",
+ 'ezx' => "{$ezpNextPath}ezx" ),

// Bool value for global development mode setting
'development-mode' => true,
diff --git a/testsBootstrap.php b/testsBootstrap.php
index 1a61379..edd7fbc 100644
--- a/testsBootstrap.php
+++ b/testsBootstrap.php
@@ -12,8 +12,8 @@ use ezp\Base\Autoloader,
ezp\Base\Configuration;

// setup autoloaders
-require 'config.php';
-require 'ezp/Base/Autoloader.php';
+require __DIR__ . 'config.php';
+require __DIR__ . 'ezp/Base/Autoloader.php';
spl_autoload_register( array( new Autoloader( $settings['base']['autoload'] ), 'load' ) );

// setup configuration
```

4. Given that ezp-next will eventually contain more then just api, might want to rename constant to EZPNEXT_ROOT_FOLDER or something.