install DoctrineFixturesBundle with Symfony2 - symfony

I try to install an existing Symfony 2.0 project, and so i run rm -rf vendor, and bin/vendor install.
He can't find DoctrineFixturesBundle, so i update my deps file and i put :
[DoctrineFixturesBundle]
git=https://github.com/doctrine/DoctrineFixturesBundle.git
target=/bundles/Symfony/Bundle/DoctrineFixturesBundle
version=origin/2.0
I run again rm -rf vendor/* and bin/vendor install, and i get this error :
The autoloader expected class "Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle" to be defined in file "/home/me/developpement/myproject/app/../vendor/bundles/Symfony/Bundle/DoctrineFixturesBundle/DoctrineFixturesBundle.php". The file was found but the class was not in it, the class name or namespace probably has a typo.
So, in my AppKernel.php i replace :
new Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle(),
with :
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
because the DoctrineFixturesBundle.php file namespace is Doctrine\Bundle\FixturesBundle.
And now, i get this error :
Fatal error: Class 'Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle' not found in /home/me/developpement/myproject/app/AppKernel.php on line 21
What should i do to make it work ?
Edited to add:
This is my autoload.php :
$loader->registerNamespaces(array(
'Symfony' => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
'Sensio' => __DIR__.'/../vendor/bundles',
'JMS' => __DIR__.'/../vendor/bundles',
'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib',
'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib',
'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
'Monolog' => __DIR__.'/../vendor/monolog/src',
'Assetic' => __DIR__.'/../vendor/assetic/src',
'Metadata' => __DIR__.'/../vendor/metadata/src',
'Gedmo' => __DIR__.'/../vendor/gedmo-doctrine-extensions/lib',
'Doctrine\\Common\\DataFixtures' => __DIR__.'/../vendor/doctrine-fixtures/lib',
'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib',
'Doctrine\\DBAL\\Migrations' => __DIR__.'/../vendor/doctrine-migrations/lib',
'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib',
'Knp\Component' => __DIR__.'/../vendor/knp-components/src',
'Knp\Bundle' => __DIR__.'/../vendor/bundles',
));

Did you check your autoload.php? This is where you tell Symfony which Namespace is located in a specific directory.

The namespace is probably not auto loaded. Check this vendor\composer\autoload_namespaces.php file and make sure it contains the following code.
'Doctrine\\Bundle\\FixturesBundle' => array($vendorDir . '/doctrine/doctrine-fixtures-bundle'),

Related

Why is Oneup/UploaderBundle so slow to upload a 'big' file (1GB)?

In a Symfony project, I have implemented the Oneup/UploaderBundle with the Oneup/FlysystemBundle to upload files to a S3 compatible storage.
I tried to upload a 1GB file, and it took about 3 min using the Aws\S3\S3Client adapter (https://flysystem.thephpleague.com/docs/adapter/aws-s3-v3/), which is way too slow.
oneup_uploader.yaml :
object_scaleway_sync:
frontend: dropzone
storage:
type: flysystem
filesystem: oneup_flysystem.object_scaleway_sync_filesystem
oneup_flysystem.yaml :
oneup_flysystem:
adapters:
xxx_fr_sync.flysystem_adapter:
awss3v3:
client: xxx_fr.sync_s3_client
bucket: 'xxxtest'
prefix: ''
filesystems:
object_scaleway_sync:
adapter: xxx_fr_sync.flysystem_adapter
After that, I tried to upload the same file using directly the S3Client in a controller, and it took about 98 seconds, which is faster, but still too slow for 1GB.
MainController.php :
$client = new S3S3Client([
'region' => 'fr-par',
'endpoint' => 'https://s3.fr-par.scw.cloud',
'version' => 'latest',
'credentials' => [
'key' => 'publickey',
'secret' => 'secretkey'
]
]);
$pathToFile = $this->getParameter('kernel.project_dir') . '/public/big.bin';
$resource = \fopen($pathToFile, 'r');
$result = $client->putObject([
'Bucket' => 'xxxtest',
'Key' => 'big.bin',
'Body' => $resource
]);
return new Response("Ok");
Strangely, this simple plain php script below took 28 seconds to upload the same file :
$s3 = new Aws\S3\S3Client([
'region' => 'fr-par',
'version' => 'latest',
'endpoint' => 'https://s3.fr-par.scw.cloud',
'credentials' => [
'key' => "publickey",
'secret' => "secretkey",
]
]);
$result = $s3->putObject([
'Bucket' => 'xxxtest',
'Key' => 'big.bin',
'SourceFile' => './big.bin'
]);
Why is this script faster than the Symfony method ? Is there a way to optimize the upload speed ?
I tried using the async S3 Simple Client (https://async-aws.com/integration/simple-s3.html) but it returned the error "Could not contact remote server" at the end of the upload.
Same error with the async S3Client (https://async-aws.com/clients/s3.html).

Codeception fails with Message 'An option named "config" already exists.'

Running Codeception 2.4.5 in a php Webproject on Ubuntu, where codeception is installed via composer
==== Redirecting to Composer-installed version in vendor/codeception ====
I get the Error
An option named "config" already exists.
While not finding the cause and the reason for this error, my temporary solution was to empty the /vendor/codeception Directory and run
composer install
This fixed the error. But now I made some changes to my tests, and it reappears.
What can be the reason ?
$: which codecept
/usr/local/bin/codecept
Content of codeception.yml
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
extensions:
enabled:
- Codeception\Extension\RunFailed
modules:
config:
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql
Content of tests/acceptance.suite.yml
class_name: AcceptanceTester
modules:
enabled:
- PhpBrowser
- \Helper\Acceptance
config:
PhpBrowser:
url: 'http://localhost/suite/www/'
Debug Output (Equal with codecept run, bin/codecept run or vendor/codeception/codeception/codecept run)
w#machine:/var/www/_wbs/wbs_suite[master]$ ./vendor/codeception/codeception/codecept run -vvv
In InputDefinition.php line 232:
[Symfony\Component\Console\Exception\LogicException]
An option named "config" already exists.
Exception trace:
Symfony\Component\Console\Input\InputDefinition->addOption() at /var/www/_wbs/wbs_suite/vendor/symfony/console/Input/InputDefinition.php:222
Symfony\Component\Console\Input\InputDefinition->addOptions() at /var/www/_wbs/wbs_suite/vendor/symfony/console/Command/Command.php:306
Symfony\Component\Console\Command\Command->mergeApplicationDefinition() at /var/www/_wbs/wbs_suite/vendor/symfony/console/Command/Command.php:206
Symfony\Component\Console\Command\Command->run() at /var/www/_wbs/wbs_suite/vendor/symfony/console/Application.php:946
Symfony\Component\Console\Application->doRunCommand() at /var/www/_wbs/wbs_suite/vendor/symfony/console/Application.php:248
Symfony\Component\Console\Application->doRun() at /var/www/_wbs/wbs_suite/vendor/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at /var/www/_wbs/wbs_suite/vendor/codeception/codeception/src/Codeception/Application.php:108
Codeception\Application->run() at /var/www/_wbs/wbs_suite/vendor/codeception/codeception/codecept:42
Debug Output in Symfony/Console/Command/Command.php->mergeApplicationDefinition()
mergeApplicationDefinitionArray
(
[help] => Symfony\Component\Console\Input\InputOption Object
(
[name:Symfony\Component\Console\Input\InputOption:private] => help
[shortcut:Symfony\Component\Console\Input\InputOption:private] => h
[mode:Symfony\Component\Console\Input\InputOption:private] => 1
[default:Symfony\Component\Console\Input\InputOption:private] =>
[description:Symfony\Component\Console\Input\InputOption:private] => Display this help message
)
[quiet] => Symfony\Component\Console\Input\InputOption Object
(
[name:Symfony\Component\Console\Input\InputOption:private] => quiet
[shortcut:Symfony\Component\Console\Input\InputOption:private] => q
[mode:Symfony\Component\Console\Input\InputOption:private] => 1
[default:Symfony\Component\Console\Input\InputOption:private] =>
[description:Symfony\Component\Console\Input\InputOption:private] => Do not output any message
)
[verbose] => Symfony\Component\Console\Input\InputOption Object
(
[name:Symfony\Component\Console\Input\InputOption:private] => verbose
[shortcut:Symfony\Component\Console\Input\InputOption:private] => v|vv|vvv
[mode:Symfony\Component\Console\Input\InputOption:private] => 1
[default:Symfony\Component\Console\Input\InputOption:private] =>
[description:Symfony\Component\Console\Input\InputOption:private] => Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
)
[version] => Symfony\Component\Console\Input\InputOption Object
(
[name:Symfony\Component\Console\Input\InputOption:private] => version
[shortcut:Symfony\Component\Console\Input\InputOption:private] => V
[mode:Symfony\Component\Console\Input\InputOption:private] => 1
[default:Symfony\Component\Console\Input\InputOption:private] =>
[description:Symfony\Component\Console\Input\InputOption:private] => Display this application version
)
[ansi] => Symfony\Component\Console\Input\InputOption Object
(
[name:Symfony\Component\Console\Input\InputOption:private] => ansi
[shortcut:Symfony\Component\Console\Input\InputOption:private] =>
[mode:Symfony\Component\Console\Input\InputOption:private] => 1
[default:Symfony\Component\Console\Input\InputOption:private] =>
[description:Symfony\Component\Console\Input\InputOption:private] => Force ANSI output
)
[no-ansi] => Symfony\Component\Console\Input\InputOption Object
(
[name:Symfony\Component\Console\Input\InputOption:private] => no-ansi
[shortcut:Symfony\Component\Console\Input\InputOption:private] =>
[mode:Symfony\Component\Console\Input\InputOption:private] => 1
[default:Symfony\Component\Console\Input\InputOption:private] =>
[description:Symfony\Component\Console\Input\InputOption:private] => Disable ANSI output
)
[no-interaction] => Symfony\Component\Console\Input\InputOption Object
(
[name:Symfony\Component\Console\Input\InputOption:private] => no-interaction
[shortcut:Symfony\Component\Console\Input\InputOption:private] => n
[mode:Symfony\Component\Console\Input\InputOption:private] => 1
[default:Symfony\Component\Console\Input\InputOption:private] =>
[description:Symfony\Component\Console\Input\InputOption:private] => Do not ask any interactive question
)
[config] => Symfony\Component\Console\Input\InputOption Object
(
[name:Symfony\Component\Console\Input\InputOption:private] => config
[shortcut:Symfony\Component\Console\Input\InputOption:private] => c
[mode:Symfony\Component\Console\Input\InputOption:private] => 4
[default:Symfony\Component\Console\Input\InputOption:private] =>
[description:Symfony\Component\Console\Input\InputOption:private] => Use custom path for config
)
)
In InputDefinition.php line 232:
[Symfony\Component\Console\Exception\LogicException]
An option named "config" already exists.
In the codeception Source are several Commands (>10), where the Option 'config' is added to the Command:
new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config')
No Idea, where to reset this and how to avoid the double Option ...

Yii2 console script not working

I want to automatically download my database backup weekly. I'm using xampp on windows. I've google around and found that I've to make use of windows task scheduler and the action script in my console controller. I've read this and this and tried running the command from command prompt. I'm getting 'Unknown command'.
My code in console controller for now just for testing
<?php
namespace console\controllers;
use Yii;
use yii\console\Controller;
/**
* Cron controller
*/
class TestController extends Controller {
public function actionIndex() {
echo "cron service runnning";
}
}
And my main config file
<?php
$params = array_merge(
require(__DIR__ . '/../../common/config/params.php'),
require(__DIR__ . '/../../common/config/params-local.php'),
require(__DIR__ . '/params.php'),
require(__DIR__ . '/params-local.php')
);
return [
'id' => 'app-console',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'console\controllers',
'components' => [
'log' => [
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'authManager' => [
'class' => 'yii\rbac\DbManager',
],
],
'modules' => [
'rbac' => [
'class' => 'johnitvn\rbacplus\Module'
]
],
'params' => $params,
];
The error I'm getting
Make sure you have TestController.php file in console/controllers folder and its name is written correctly.
Then from project root folder you can call your command like that:
php yii test/index
or just:
php yii test
(because index is a default action (configured in $defaultAction) and you can omit it).
If you are outside of project folder, make sure to provide correct path:
php /path/to/project/folder/yii test

shared object ‘RCurl.so’ not found

Data about my system
R version 3.2.1 (2015-06-18) (World-Famous Astronaut)
Ubuntu 12.04 LTS
$ locate RCurl.so:
~/R/i686-pc-linux-gnu-library/2.15/RCurl/libs/RCurl.so
~/R/i686-pc-linux-gnu-library/3.0/RCurl/libs/RCurl.so
~/R/i686-pc-linux-gnu-library/3.1/RCurl/libs/RCurl.so
/usr/local/lib/R/site-library/RCurl/libs/RCurl.so
$ r -pie '.libPaths()':
[1] "~/R/i686-pc-linux-gnu-library/3.2"
[2] "/usr/local/lib/R/site-library"
[3] "/usr/lib/R/site-library"
[4] "/usr/lib/R/library"
$ R CMD ldd /usr/local/lib/R/site-library/RCurl/libs/RCurl.so:
linux-gate.so.1 => (0xb7734000)
libcurl-gnutls.so.4 => /usr/lib/i386-linux-gnu/libcurl-gnutls.so.4 (0xb7696000)
libR.so => /usr/lib/R/lib/libR.so (0xb7319000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb716f000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb7151000)
libidn.so.11 => /usr/lib/i386-linux-gnu/libidn.so.11 (0xb711d000)
liblber-2.4.so.2 => /usr/lib/i386-linux-gnu/liblber-2.4.so.2 (0xb710e000)
libldap_r-2.4.so.2 => /usr/lib/i386-linux-gnu/libldap_r-2.4.so.2 (0xb70bc000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb70b2000)
libgssapi_krb5.so.2 => /usr/lib/i386-linux-gnu/libgssapi_krb5.so.2 (0xb7075000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb705f000)
libgnutls.so.26 => /usr/lib/i386-linux-gnu/libgnutls.so.26 (0xb6f9a000)
libgcrypt.so.11 => /lib/i386-linux-gnu/libgcrypt.so.11 (0xb6f14000)
librtmp.so.0 => /usr/lib/i386-linux-gnu/librtmp.so.0 (0xb6ef9000)
libblas.so.3gf => /usr/lib/libblas.so.3gf (0xb6c24000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb6bf8000)
libreadline.so.6 => /lib/i386-linux-gnu/libreadline.so.6 (0xb6bbe000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb6b82000)
liblzma.so.5 => /usr/lib/i386-linux-gnu/liblzma.so.5 (0xb6b5a000)
libbz2.so.1.0 => /lib/i386-linux-gnu/libbz2.so.1.0 (0xb6b49000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb6b44000)
libgomp.so.1 => /usr/lib/i386-linux-gnu/libgomp.so.1 (0xb6b21000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb6b06000)
/lib/ld-linux.so.2 (0xb7735000)
libresolv.so.2 => /lib/i386-linux-gnu/libresolv.so.2 (0xb6aed000)
libsasl2.so.2 => /usr/lib/i386-linux-gnu/libsasl2.so.2 (0xb6ad1000)
libgssapi.so.3 => /usr/lib/i386-linux-gnu/libgssapi.so.3 (0xb6a94000)
libkrb5.so.3 => /usr/lib/i386-linux-gnu/libkrb5.so.3 (0xb69c5000)
libk5crypto.so.3 => /usr/lib/i386-linux-gnu/libk5crypto.so.3 (0xb699d000)
libcom_err.so.2 => /lib/i386-linux-gnu/libcom_err.so.2 (0xb6997000)
libkrb5support.so.0 => /usr/lib/i386-linux-gnu/libkrb5support.so.0 (0xb698e000)
libtasn1.so.3 => /usr/lib/i386-linux-gnu/libtasn1.so.3 (0xb697c000)
libp11-kit.so.0 => /usr/lib/i386-linux-gnu/libp11-kit.so.0 (0xb696a000)
libgpg-error.so.0 => /lib/i386-linux-gnu/libgpg-error.so.0 (0xb6965000)
libgfortran.so.3 => /usr/lib/i386-linux-gnu/libgfortran.so.3 (0xb6856000)
libtinfo.so.5 => /lib/i386-linux-gnu/libtinfo.so.5 (0xb6837000)
libheimntlm.so.0 => /usr/lib/i386-linux-gnu/libheimntlm.so.0 (0xb682f000)
libkrb5.so.26 => /usr/lib/i386-linux-gnu/libkrb5.so.26 (0xb67ac000)
libasn1.so.8 => /usr/lib/i386-linux-gnu/libasn1.so.8 (0xb6707000)
libhcrypto.so.4 => /usr/lib/i386-linux-gnu/libhcrypto.so.4 (0xb66d1000)
libroken.so.18 => /usr/lib/i386-linux-gnu/libroken.so.18 (0xb66bb000)
libkeyutils.so.1 => /lib/i386-linux-gnu/libkeyutils.so.1 (0xb66b7000)
libquadmath.so.0 => /usr/lib/i386-linux-gnu/libquadmath.so.0 (0xb6624000)
libwind.so.0 => /usr/lib/i386-linux-gnu/libwind.so.0 (0xb65fb000)
libheimbase.so.1 => /usr/lib/i386-linux-gnu/libheimbase.so.1 (0xb65eb000)
libhx509.so.5 => /usr/lib/i386-linux-gnu/libhx509.so.5 (0xb65a4000)
libsqlite3.so.0 => /usr/lib/i386-linux-gnu/libsqlite3.so.0 (0xb64ff000)
libcrypt.so.1 => /lib/i386-linux-gnu/libcrypt.so.1 (0xb64ce000)
(Noted: no ??? error as suggested in Got message unable to load shared object stats.so when R starts.)
Problem description & what I tried
I apparently have several RCurl.so objects, but when I try to install.packages('RCurl') into ~/R/i686-pc-linux-gnu-library/3.2/RCurl/, I get the following error:
Error in library.dynam(lib, package, package.lib) :
shared object ‘RCurl.so’ not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘~/R/i686-pc-linux-gnu-library/3.2/RCurl’
The downloaded source packages are in
‘/tmp/user/1001/RtmpVJ2RYv/downloaded_packages’
Running library.dynam() with one of the old RCurl.so's didn't work either.
I also tried R CMD INSTALL [path to downloaded omega-hat source].tar.gz. Same error.
Question
Looking around on the internet there seem to be a lot of people with shared object problems. But I can't tell from those who answered them, what I need to do, or even what help files I need to be reading. I think I've worked through most / every one of the arguments in ?install.packages and ?INSTALL.
What else could be going wrong here?

How to create table using .install file in Drupal 7

I am new to drupal, working on custom module, here is my .install file code, but its not creating table in database when I install module. can anyone please tell me where I am wrong
<?php
function make_application_schema()
{
$schema['make_master'] = array(
'description' => 'Make master table',
'fields' => array(
'make_id' => array(
'description' => 'make id primary key auto increment',
'type' => 'serial',
'not null' => TRUE,
),
'make_name' => array(
'description' => 'Make name',
'type' => 'varchar',
'length' => '100',
'not null' => TRUE,
),
'make_status' => array(
'description' => 'check make status',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
),
),
'primary key' => array('make_id'),
);
return $schema;
}
function make_application_install()
{
}
function make_application_uninstall()
{
}
What is the name of your module? When you are installing and you use hook_schema, you should name your function like this:
my_module.module
In my_module.install
function my_module_schema () ....
And... after that, this should be work :)
In order to install your database 'make_master' you have to call drupal_install_schema with your module name:
drupal_install_schema('make_application');
according to your question I think you have forgot to call drupal_install_schema function. Here are updated make_application_install and make_application_uninstall of your make_application.install.
function make_application_install() {
// Use schema API to create database table.
drupal_install_schema('make_master');
}
function make_application_uninstall() {
// Remove tables.
drupal_uninstall_schema('make_master');
}
NOTE
The tables won't install on module enable, they will only install on first-time install. First, disable the module, then click the 'uninstall' tab, select the module, and uninstall it (note: if your module doesn't have a hook_uninstall() function, it won't appear here - make sure you have added this function). Then, click the list tab, and re-enable your module. This is a first-time install, and the tables will install.
Either that or use the devel module, enable the development block and then use the 'reinstall modules' link in the block.
You can refer this link for more info : https://www.drupal.org/node/811594

Resources