Symfony2 : Installation CCDNMessageMessageBundle - php

I'm trying to install the Symfony bundle CCDNMessageMessageBundle.
To do this I :
installed Symfony (2.0.17)
executed php bin/vendors install with git
followed the indications in here
The problem comes in step 4 of this documentation (Run vendors install script) :
There are many errors - this are the first lines :
Installing/Updating CCDNMessageMessageBundle f7ee2c184257011e2991b34ac5cfe9a8b01c6889
HEAD is now at f7ee2c1
Update documentation
PHP Fatal error: Class 'CCDNMessage\MessageBundle\CCDNMessageBundle' not found in
xxxxxxxxxxxx\app\AppKernel.php on line 20 ...
For information :
AppKernel.php, line 20 contains :
new CCDNMessage\MessageBundle\CCDNMessageBundle(),
as last element of array $bundles.
autoload.php contains this registerNamespaces :
$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',
'CCDNMessage' => __DIR__.'/../vendor/bundles',
));
And at the end of deps I entered :
[CCDNMessageMessageBundle]
git=http://github.com/codeconsortium/CCDNMessage.git
target=/bundles/CCDNMessage/MessageBundle
version=v1.2
I think I did all the steps in the documentation !
Someone can help me to resolve this problem ?

The git url in deps is wrong, should be
[CCDNMessageMessageBundle]
git=git://github.com/codeconsortium/CCDNMessageMessageBundle.git
target=/bundles/CCDNMessage/MessageBundle
version=v1.2
or with HTTP
[CCDNMessageMessageBundle]
git=http://github.com/codeconsortium/CCDNMessageMessageBundle.git
target=/bundles/CCDNMessage/MessageBundle
version=v1.2

Related

CakePHP: upgrade from 3.6.x to 4.0 "Missing Template Exception"

I followed the upgrade guide (after I upgraded from 3.6 to 3.8) but I get this error:
Error: [Cake\View\Exception\MissingTemplateException] Template file "Error\error500.ctp" is missing
....
If you want to customize this error message, create src\Template\Error\fatal_error.ctp
After the upgrade procedure my templates moved to app_name\templates directory and renamed to *.php instead of *.ctp . I updated the app.php and app.default.php with the new paths:
'App' => [
'namespace' => 'App',
'encoding' => env('APP_ENCODING', 'UTF-8'),
'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US'),
'defaultTimezone' => env('APP_DEFAULT_TIMEZONE', 'UTC'),
'base' => false,
'dir' => 'src',
'webroot' => 'webroot',
'wwwRoot' => WWW_ROOT,
//'baseUrl' => env('SCRIPT_NAME'),
'fullBaseUrl' => false,
'imageBaseUrl' => 'img/',
'cssBaseUrl' => 'css/',
'jsBaseUrl' => 'js/',
'paths' => [
'plugins' => [ROOT . DS . 'plugins' . DS],
'templates' => [ROOT . DS . 'templates' . DS],
'locales' => [ROOT . DS . 'Locale' . DS],
],
],
But still the application is looking for the template files with .ctp extension and under src\Template\...
What am I missing?
From my experience:
Upgrade CakePHP 3.x to 4.x
composer update
run phpstan from --level 0 to 2 and fix your code or test in scrutinizer
read 4.0 Migration Guide : https://book.cakephp.org/4/en/appendices/4-0-migration-guide.html
read 4.0 Upgrade Guide : https://book.cakephp.org/4/en/appendices/4-0-upgrade-guide.html
Steps:
Install the upgrade tool
Rename locale files
Rename template files
Once you've renamed your template and locale files, make sure you update App.paths.locales and App.paths.templates paths to be correct.
From your app composer file remove all cakephp/* (cakephp3) packages, also phpstan, code standards, phpunit,.. run composer update
Applying Rector Refactorings
composer require --update-with-dependencies "phpunit/phpunit:^8.0"
composer require --update-with-dependencies "cakephp/cakephp:4.0.*"
Install fresh cakephp4 inside your app folder. Example: mkdir cakephp4 && cd cakeph4; and run composer create-project --prefer-dist cakephp/app:4.* .;
compare your old cakephp files with files from cakephp4 folder, update all and copy missing files
delete cakephp4 and upgrade folders
don't forget at top of you php files to add <?php declare(strict_types=1);
composer cs-check then composer cs-fix

Zendframework 2 with memcache not working

I am trying to get memcache to work with Zendframework 2. How do I get Zendframework 2 to see memcache correct so I don't get the error I have listed below? I want to use memcache instead of memcached.
Error:
Exception - An abstract factory could not create an instance of memcache(alias: memcache).
Previous exceptions - An exception was raised while creating "memcache"; no instance returned
The option "liboptions" does not have a matching setLiboptions setter method which must be defined
I get this error when just trying to test it with this line in a controller
echo $this->getServiceLocator()->get('memcache')->getVersion();
Details:
I'm running windows 7 64 bit with a local instance of IIS7 up and running.
I used this guide to install memecache on my pc: How to Install Memcache on Windows 7
I verified the memcache service is up and running
I verified that using memecache outside of Zendframework 2 works.
So next I followed this guide to get it to work in Zendframework 2: How to setup Zendframework 2 to use Memcached I know this guide is for memcached and not memcache but I used it as a base
Troubleshooting I've done already:
Verified service is running
Verified phpinfo() shows the memcache section so I know the php extension is loading from the php.ini
Since I'm still hazy on memcache vs memcached I've tried setting the config files and above echo to try and use the string
'memcached' and 'memcache' to see if that would help find it, but
didn't work.
I read some things online about how a 'Di' thing can conflict with this. I verified my config does not load anything with 'Di'
Verified that the abstract factory setting is loaded in the config under Service Manager
Code:
config var_dump showing the abstract factory part is loading
$sm = $this->getServiceLocator();
$config = $sm->get('config');
var_dump($config);die();
'service_manager' =>
array (size=3)
'abstract_factories' =>
array (size=2)
0 => string 'Zend\Cache\Service\StorageCacheAbstractServiceFactory' (length=53)
1 => string 'Zend\Log\LoggerAbstractServiceFactory' (length=37)
'aliases' =>
array (size=2)
'translator' => string 'MvcTranslator' (length=13)
'db' => string 'Zend\Db\Adapter\Adapter' (length=23)
'factories' =>
array (size=1)
'Zend\Db\Adapter\Adapter' => string 'Zend\Db\Adapter\AdapterServiceFactory' (length=37)
My cache.local.php and it's in the autoload directory of zendframework 2 (taken from above tutorial link and removed the 'd')
I think this is what I need to change just not sure how....
return array(
'caches' => array(
'memcache' => array( //can be called directly via SM in the name of 'memcache'
'adapter' => array(
'name' =>'memcache',
'lifetime' => 86400, //24 hours
'options' => array(
'servers' => array(
array(
'127.0.0.1',11211 //Server IP, Port
)
),
'namespace' => 'MYMEMCACHENAMESPACE',
'liboptions' => array (
'COMPRESSION' => true,
'binary_protocol' => true,
'no_block' => true,
'connect_timeout' => 120
)
)
),
'plugins' => array(
'exception_handler' => array(
'throw_exceptions' => false
),
),
),
),
);
You need to install the PHP library memcached so you can use ZFs Memcached Adaptor. ZF does not have an adaptor for the memcache library so it's trying to use the library directly which does not have a setter for liboptions. Either install memcached or remove liboptions in your config and you should be all set.

pin payment error - vendor/autoload.php not found

I have installed composer on my pc and running a pin payment script.
require_once __DIR__.'/vendor/autoload.php';
use Omnipay\Common\GatewayFactory;
$gateway = GatewayFactory::create('Pin');
$gateway->setSecretKey('1111111111');
$gateway->purchase(array(
'email' => 'abc.php2#gmail.com',
'description' => 'Widgets',
'amount' => '49.99',
'currency' => 'USD',
'card_token' => $_REQUEST['card_token'],
'ip_address' => $_REQUEST['ip_address']
))->send();
I am not sure about require_once _DIR_.'/vendor/autoload.php'; , where can i find the exact path for the same.
I think as you as "but where do I find the vendor" that you did not run the composer install command.
You have to run it in order to create the vendor dorectory and download the packages. Find out more in the documentation: http://getcomposer.org/doc/00-intro.md#using-composer
Basically, run:
composer install

ZF2 + doctrine without composer

I have a working ZF2 (skeleton) application and want to integrate Doctrine.
I have downloaded the 2 modules (DoctrineModule and DoctrineORMModule) from github as I'm unable to use composer (so please don't answer with; "get composer").
After hours of trying to find the problem I keep getting the following error:
Fatal error: Class 'Doctrine\Common\Annotations\AnnotationRegistry' not found in doctrine/DoctrineModule/src/DoctrineModule/Module.php on line 54.
I have spend hours of searching and trying to debug but I can't find a way to fix it. Please help me.
DoctrineORMModule does not explicitly support autoloading without composer (since it's a mess).
As of current (0.7.*) version of DoctrineORMModule, the required packages are following:
doctrine/common (2.3.0)
doctrine/dbal (2.3.2)
symfony/console (v2.1.7)
doctrine/orm (2.3.2)
doctrine/doctrine-module (0.7.*)
doctrine/doctrine-orm-module (0.7.0)
What you can do is defining all the autoloading namespaces in init_autoloader.php in your skeleton application (explaining the mess). The code to replace is the part about the autoloader factory:
Zend\Loader\AutoloaderFactory::factory(array(
'Zend\Loader\StandardAutoloader' => array(
'autoregister_zf' => true,
'namespaces' => array(
'Doctrine\Common' => __DIR__ . '/vendor/doctrine/common',
'Doctrine\DBAL' => __DIR__ . '/vendor/doctrine/dbal',
'Symfony\Console' => __DIR__ . '/vendor/symfony/console',
'DoctrineModule' => __DIR__ . '/vendor/doctrine/doctrine-module',
'DoctrineORMModule' => __DIR__ . '/vendor/doctrine/doctrine-orm-module',
),
),
));
You will have to configure the various git submodules on your own
As of version 0.8.* of the modules, the dependencies will increase quite a bit because of how doctrine/common was splitted recently, so consider finding a solution to start using composer or you will just be delaying huge problems in future.
This solution should work for now.
Try to edit the following method in the Module.php of the Application module:
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
'Doctrine' => //Path where your doctrine dist resides
),
),
);
}
There is no need to define autoloading configuration for DoctrineModule and DoctrineORMModule because this are ZF2 modules and are providing autoloading configuration already.
Form annotations require Doctrine\Common, which contains an annotation parsering engine. The simplest way to install Doctrine\Common is if you are using Composer; simply update your composer.json and add the following line to the require section:
"doctrine/common": ">=2.1",
Then run php composer.phar update to install the dependency.
If you’re not using Composer, visit the Doctrine project website for more details on installation.

PHP Fatal error: Class 'Doctrine\Common\Persistence\Mapping\Driver\FileDriver' not found

I follow the instructions at: http://symfony.com/doc/current/bundles/DoctrineMongoDBBundle/index.html step by step and have a Mongo server running however when I try to do :
php app/console generate:bundle --namespace=Acme/StoreBundle
I get
Class 'Doctrine\Common\Persistence\Mapping\Driver\FileDriver' not found in /Users/username/Sites/myapp/vendor/doctrine-mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Driver/XmlDriver.php on line 37
I am thinking something could be wrong with my parameters.ini file which still mentions MYSQL however the link above did not mention anything about that:
[parameters]
database_driver="pdo_mysql"
database_host="localhost"
database_port=""
database_name="somedb"
database_user="root"
database_password="mypassword"
mailer_transport="smtp"
mailer_host="localhost"
mailer_user=""
mailer_password=""
locale="en"
secret="093faacf47bcdcdcdcdcdc9d152fc8b"
what am I doing wrong?
UPDATE:
I have Doctrine Common downloaded and here is my registerNameSpaces function:
$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\\ODM\\MongoDB' => __DIR__.'/../vendor/doctrine-mongodb-odm/lib',
'Doctrine\\MongoDB' => __DIR__.'/../vendor/doctrine-mongodb/lib',
'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
'Monolog' => __DIR__.'/../vendor/monolog/src',
'Assetic' => __DIR__.'/../vendor/assetic/src',
'Metadata' => __DIR__.'/../vendor/metadata/src',
'FOS' => __DIR__.'/../vendor/bundles',
'FOS\\Rest' => __DIR__.'/../vendor/fos',
'JMS' => __DIR__.'/../vendor/bundles',
));
my deps file:
[symfony]
git=http://github.com/symfony/symfony.git
version=origin/2.0
[twig]
git=http://github.com/fabpot/Twig.git
version=v1.8.2
[monolog]
git=http://github.com/Seldaek/monolog.git
version=1.0.2
[doctrine-common]
git=http://github.com/doctrine/common.git
version=2.1.4
[doctrine-dbal]
git=http://github.com/doctrine/dbal.git
version=2.1.7
[doctrine]
git=http://github.com/doctrine/doctrine2.git
version=2.1.7
[swiftmailer]
git=http://github.com/swiftmailer/swiftmailer.git
version=v4.2.0
[assetic]
git=http://github.com/kriswallsmith/assetic.git
version=v1.0.3
[twig-extensions]
git=http://github.com/fabpot/Twig-extensions.git
[metadata]
git=http://github.com/schmittjoh/metadata.git
version=1.0.0
[SensioFrameworkExtraBundle]
git=http://github.com/sensio/SensioFrameworkExtraBundle.git
target=/bundles/Sensio/Bundle/FrameworkExtraBundle
version=origin/2.0
[JMSSecurityExtraBundle]
git=http://github.com/schmittjoh/JMSSecurityExtraBundle.git
target=/bundles/JMS/SecurityExtraBundle
version=origin/1.0.x
[SensioDistributionBundle]
git=http://github.com/sensio/SensioDistributionBundle.git
target=/bundles/Sensio/Bundle/DistributionBundle
version=origin/2.0
[SensioGeneratorBundle]
git=http://github.com/sensio/SensioGeneratorBundle.git
target=/bundles/Sensio/Bundle/GeneratorBundle
version=origin/2.0
[AsseticBundle]
git=http://github.com/symfony/AsseticBundle.git
target=/bundles/Symfony/Bundle/AsseticBundle
version=origin/2.0
[FOSUserBundle]
git=git://github.com/FriendsOfSymfony/FOSUserBundle.git
target=bundles/FOS/UserBundle
version=1.2.0
[FOSRest]
git=git://github.com/FriendsOfSymfony/FOSRest.git
target=fos/FOS/Rest
[FOSRestBundle]
git=git://github.com/FriendsOfSymfony/FOSRestBundle.git
target=bundles/FOS/RestBundle
[JMSSerializerBundle]
git=git://github.com/schmittjoh/JMSSerializerBundle.git
target=bundles/JMS/SerializerBundle
[doctrine-mongodb]
git=http://github.com/doctrine/mongodb.git
[doctrine-mongodb-odm]
git=http://github.com/doctrine/mongodb-odm.git
[DoctrineMongoDBBundle]
git=http://github.com/doctrine/DoctrineMongoDBBundle.git
target=/bundles/Symfony/Bundle/DoctrineMongoDBBundle
version=origin/2.0
I also do not see a Driver folder under mapping. I have done a php bin/vendors install --reinstall bu even that doesnt help.
You have to update the three: DBAL, Common and ORM. The three have been released at the same time. So you should use version 2.2 for the 3.
Here is the blog post http://www.doctrine-project.org/blog/doctrine-2-2-final.html
Hope this helps, it worked for me.
Doctrine MongoDB ODM was recently refactored to utilize Doctrine Common's mapping API, which exists in version 2.2+ (see PR's #350 and #370). In turn, both the 2.0 and master branches of the bundle were updated (PR #124).
Based on your deps file, you're using Doctrine Common 2.1.x, which doesn't contain the required classes. You can either bump Common to 2.2, which should be compatible with Symfony 2.0, or lock ODM and the bundle to an earlier commit hash before those PR's were merged. Checking the composer.json files in each repository would be a good way to keep track of these dependencies, even if you aren't using Composer. Hopefully, we'll have tags on the Mongo ODM repositories soon, which should alleviate this headache in the future.
You either don't have Doctrine Common installed, or you don't have it registered in your autoloader. Install it (link: https://github.com/doctrine/common) or redownload the sf2 standard edition.

Categories