The project works in my local environment but when I deploy it on shared web server it doesn't work.
Server
/home
/app
/src
/gestor
/UsuarioBundle
...
/vendors
....
/public_html
/web
app.php
...
If I go to host/app.php ->
Fatal error:
Class 'Gestor\UsuarioBundle\UsuarioBundle' not found in /home/esdrhazc/app/AppKernel.php on line 19
AppKernel.php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Gestor\UsuarioBundle\UsuarioBundle(),
new Gestor\AdministracionBundle\AdministracionBundle(),
new Gestor\ExpedientesBundle\ExpedientesBundle(),
new Gestor\GestionBundle\GestionBundle(),
new \Ideup\SimplePaginatorBundle\IdeupSimplePaginatorBundle(),
new Gestor\MensajeBundle\MensajeBundle(),
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle()
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
Autoload.php
use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;
/**
* #var ClassLoader $loader
*/
$loader = require __DIR__.'/../vendor/autoload.php';
$loader->add('Gestor', __DIR__.'/../src');
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader;
And finally, for instance, class Usuario.php
namespace Gestor\UsuarioBundle\Entity;
...
class Usuario implements AdvancedUserInterface {...}
I have deleted server/app/cache and give permissions.
Thanks in advance!!!
Change the folder 'gestor' to 'Gestor'
Related
I am creating a custom API for SuiteCRM. When I attempt to run the new API from {CRM Home}/custom/service/v4_1_custom I receive an 'HTTP ERROR 500'. There are not errors in the error_log file or the SuiteCRM.log file.
I have followed the method in the following two url's
https://fayebsg.com/2013/05/extending-the-sugarcrm-api-updating-dropdowns/
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.0/Integration/Web_Services/Legacy_API/Extending_Web_Services/
registry.php
<?php
require_once('service/v4_1/registry.php');
class registry_v4_1_custom extends registry_v4_1
{
protected function registerFunction()
{
parent::registerFunction();
$this->serviceClass->registerFunction('test', array(), array());
}
}
SugarWebServicesImplv4_1_custom.php
<?php
if(!defined('sugarEntry'))define('sugarEntry', true);
require_once('service/v4_1/SugarWebServiceImplv4_1.php');
class SugarWebServiceImplv4_1_custom extends SugarWebServiceImplv4_1
{
/**
* #return string
*/
public function test()
{
LoggerManager::getLogger()->warn('SugerWebServiceImplv4_1_custom test()');
return ("Test Worked");
} // test
} // SugarWebServiceImplv4_1_custom
I found the answer to this issue.
In the file {SuiteCRM}/include/entryPoint.php there are many files that are included thru require_once. In this list of require_once files, there were 4 files that were set as require not require_once. These were classes and therefore could not be included a second time. I changed these to require_once and the HTTP Error 500 went away and the custom APIs started working.
I installed Symfony4 using the following steps.
step1: composer create-project "Symfony/skeleton:^4.0” symfony4
step2: git status
step3: git add.
step4: git commit
step5: composer require annotations
step6: create a controller named ArticleController
<?php
namespace App\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Response;
class ArticleController
{
/**
* #Route("/")
*/
public function indexAction()
{
return new Response('OMG! My first page already! Wooooo!');
}
/**
* #Route("/{id}", requirements={"id" = "\d+"}, defaults={"id" = 1})
*/
public function showAction($id)
{
echo 123;die;
}
/**
* #Route("/news/{$slug}")
* #Method({"GET", "POST"})
*/
public function news($slug)
{
return new Response(sprintf('Today new is "%s"', $slug));
}
}
Step7: access http://127.0.0.1:8000
You can view 'OMG! My first page already! Wooooo!'.
But http://127.0.0.1:8000/123 and http://127.0.0.1:8000/news/test do not work. Who can tell me why? And please help me to fix it.
Just find the solution.
composer require symfony/apache-pack
It will automatically generate .htaccess.
the right namespace is :
use Symfony\Component\Routing\Annotation\Route;
thanks
I'm trying to create a custom module for Magento 2 and I've got to the point of defining the schema in the /Setup/InstallSchema.php
When running 'php bin/magento setup:upgrade' I get the error:
Call to undefined function Test/Connector/Setup/getConnection()
The module is enabled and correctly showing in the config file. The schema file I'm trying to run is:
<?php
namespace Test\Connector\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\DB\Ddl\Table;
class InstallSchema implements InstallSchemaInterface
{
public function install(SchemaSetupInterface $setup, ModuleContextInterface
$context) {
$installer = $setup;
$installer->startSetup();
$tableName = $installer->getTable('test_connector_settings');
if ($installer->getConnection()->isTableExists($tableName) != true) {
$table = $installer->getConnection()
->newTable($installer->getTable('ipos_connector_settings'))
->addColumn('id', Table::TYPE_SMALLINT, null, ['identity'=> true, 'nullable'=>false, 'primary'=>true], 'ID')
->addColumn('api_url', Table::TYPE_TEXT, 255, ['nullable'=>true], 'API URL')
->addColumn('api_user', Table::TYPE_TEXT, 100, ['nullable'=>false], 'API User Name')
->addColumn('api_password', Table::TYPE_TEXT, 100, ['nullable'=>false], 'API Password');
$installer-getConnection()->createTable($table);
}
$installer->endSetup();
}
}
Thanks in advance,
Please change this line
$installer-getConnection()->createTable($table); // your code line.
With
$installer->getConnection()->createTable($table);
I'm trying to deploy a website made with the Zend Framework. The website is running fine on my local environment, I'm trying to deploy it on my VPS. But I'm running into some difficulties.
Now it says the following:
*Fatal error: Class 'Doctrine_Manager' not found in /is/htdocs/wpxxxxx/www/mensenenjij/application/Bootstrap.php on line 12*
It properly includes the Doctrine classes but it can't instantiate a new Doctrine_Manager. Anybody knows why?
Bootstrap.php:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initDoctrine()
{
require_once 'Doctrine/Doctrine.php';
$this->getApplication()
->getAutoloader()
->pushAutoloader(array('Doctrine', 'autoload'), 'Doctrine');
$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(
Doctrine::ATTR_MODEL_LOADING,
Doctrine::MODEL_LOADING_CONSERVATIVE
);
$config = $this->getOption('doctrine');
$conn = Doctrine_Manager::connection($config['dsn'], 'doctrine');
return $conn;
}
}
I am trying to connect Symfony 2 with MongoDB in such way:
Register DoctrineMongoDBBundle in AppKernel::registerBundles
method
Set 'doctrine_mongo_db' configuration (see below config.yml)
Get 'doctrine.odm.mongodb.document_manager' from container in
HelloController action
And when I am trying to run the application MongoConnectionException is thrown.
Can anyone help me to solve this problem?
AppKernel.php
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\DoctrineMongoDBBundle\DoctrineMongoDBBundle(),
new Sensio\HelloBundle\HelloBundle()
);
return $bundles;
}
config.yml
framework:
charset: UTF-8
router: { resource: "%kernel.root_dir%/config/routing.yml" }
templating: { engines: ['twig'] }
## Doctrine Configuration
doctrine_mongo_db:
server: mongodb://root:root#192.168.0.111:27017
default_database: test
options: { connect: true }
mappings:
HelloBundle: { type: annotation, dir: Document }
# Twig Configuration
twig:
debug: %kernel.debug%
strict_variables: %kernel.debug%
HelloController.php
/* #var $dm \Doctrine\ODM\MongoDB\DocumentManager */
$dm = $this->get('doctrine.odm.mongodb.document_manager');
Exception (line 96)
connecting to failed: Transport endpoint is not connected
in ~/vendor/doctrine-mongodb/lib/Doctrine/MongoDB/Connection.php line 96 »
93. if ($this->server) {
94. $this->mongo = new \Mongo($this->server, $this->options);
95. } else {
96. $this->mongo = new \Mongo();
97. }
The problem is in DoctrineMongoDBBundle configuration loading. The fix (https://github.com/fabpot/symfony/pull/740) should be merged soon.
For now you can use fixed method below.
public function load(array $configs, ContainerBuilder $container)
{
$mergedConfig = array();
foreach ($configs as $config) {
$mergedConfig = array_merge_recursive($mergedConfig, $config);
}
$this->doMongodbLoad($mergedConfig, $container);
}