I know that there are similar topics on the website. But I couldn't find a solution for my problem.
I'm searching to add a Alfresco Php SDK library to my symfony project. I'm using Symfony 2.2. I tried several methods of integration but no one worked. I couldn't find the library in Composer repository either.
The last method that I tried was to add library manual in composer.
The library doesn't respect PSR-0 normes neither PEAR. So I tried to extend the classes and add namespaces to them.
Folder structure:
vendor
|_ /alfresco
|_ /lib
|_ /Alfresco
|_ /Service
|_ Alfresco.php
Alfresco.php file ... Not sure if I did it correctly :
<?php
#vendor/alfresco/lib/Alfresco/Alfresco.php
namespace Alfresco\Service;
/**
* class Alfresco_Association
*/
require_once 'Service/Association.php';
class Alfresco_Association extends Association {}
/**
* class Alfresco_BaseObject
*/
require_once 'Service/BaseObject.php';
class Alfresco_BaseObject extends BaseObject {}
/**
* class Alfresco_ChildAssociation
*/
require_once 'Service/ChildAssociation.php';
class Alfresco_ChildAssociation extends ChildAssociation {}
/**
* class Alfresco_ContentData
*/
require_once 'Service/ContentData.php';
class Alfresco_ContentData extends ContentData {}
...
...
After that I added a path in to composer.json :
#composer.json
...
"autoload": {
"psr-0": {
"": "src/",
"Alfresco": "vendor/alfresco/lib"
}
...
Controller :
#src/Acme/DemoBundle/Controller/DemoController.php
...
...
use Alfresco\Service;
class DemoController extends Controller
{
...
/**
* @Route("/hello/{name}", name="_demo_hello")
* @Template()
*/
public function helloAction($name)
{
$name=new \Alfresco\Service\Alfresco_Repository();
return array('name' => $name);
}
...
The result is that I have an error :
FatalErrorException: Error: Class 'Alfresco\Service\Alfresco_Repository' not found in ...