symfony 3.4 data fixture - php

I upgraded symfony 3.3 to 3.4 and now having problem with datafixture bundle , trying to seed data for testing but got this error :
Attempted to call an undefined method named "addClass" of class
"Doctrine\ORM\Internal\CommitOrderCalculator"
this is part of my ccomposer.json file :
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
}
any help will be appreciated

You have to upgrade the data-fixtures manually in your composer.json file. Try to upgrade it to version 1.3 like this:
"doctrine/data-fixtures": "^1.3"

Related

Laravel shopping cart (5.8)

I'm using eclipse PDT, with CodeMix, Terminal+, Composer, and symphony. I created a Laravel project and in my composer.json I have the following dependencies:
"require" : {
"php": "^7.1.3",
"cyvelnet/laravel5-fractal": "^2.3",
"darryldecode/cart": "~4.0",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"intervention/image": "dev-master",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0",
"league/fractal": "^0.18.0",
"ssheduardo/redsys-laravel": "~1.3.0"
},
I also added in my app.php both the service provider
'providers' => [
#Lots of other providers here
Darryldecode\Cart\CartServiceProvider::class,
],
and the facade alias
'aliases' => [
#lots of other aliases
'Cart' => Darryldecode\Cart\Facades\CartFacade::class
],
I even published the provider php artisan vendor:publish --provider="Darryldecode\Cart\CartServiceProvider" --tag="config"
But somehow whenever I try to include the thing in any of my files either with use \Cart;, use \Darryldecode\Cart\Facades\CartFacade; or use \Darryldecode\Cart\Cart; it gives me a
The import whichever one I'm using cannot be resolved
Already tried clearing the cache, closing, and opening eclipse, deleting the project from the workspace and starting it again, uninstalling and reinstalling the cart and I don't know what else to do. Also tried Gloudemans instead and it gives me the same error.
Just using
'Cart' => Darryldecode\Cart\Cart::class,
instead of
'Cart' => Darryldecode\Cart\Facades\CartFacade::class
I solved it by manually adding the vendor folder to the builpath, foir some strange reason composer wasn't adding it.

Laravel 5 - Custom Package "Class Not Found" When Pushed to Heroku

I'm having a bit of trouble getting a custom package to work when deploying my Laravel app to Heroku. It works fine locally, but when pushed I get the following error:
In ProviderRepository.php line 208: Class 'totalWebConnections\simpleBlog\simpleBlogServiceProvider' not found
It looks like the server is correctly loading the package from my composer file, just above the error in the log:
Installing totalwebconnections/simple-blog (1.0.0)
In my composer.json
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"totalwebconnections/simple-blog": "1.0.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/",
"totalWebConnections\\simpleBlog\\": "vendor/totalWebConnections/simple-blog/src/"
}
},
And then in my app.php
totalWebConnections\simpleBlog\simpleBlogServiceProvider::class,
I'm not sure what the issue is?
I think you should double check your namespaces and case of file names - when you deploy on Windows for example it doesn't care whether it's simpleBlog or SimpleBog but when deployed to Linux server it won't work if it's not 100% same as it should be.

Adding a composer package to Laravel 5

"require": {
"infusionsoft/php-sdk": "^1.2",
"laravel/lumen-framework": "5.1.*",
"vlucas/phpdotenv": "~1.0",
"barryvdh/laravel-debugbar": "^2.2",
"goaop/framework": "^2.0",
"php-http/httplug": "^1.1",
"infusionsoft/old-php-isdk": "*"
},
I'm trying to use the "infusionsoft/old-php-isdk" which is in the packagist composer repository but it's not specific to Laravel. I'm using an order controller and it's code that I picked up from another developer so he references the current (and working) "infusionsoft/php-sdk" as the following
"use infusionsoft\infusionsoft;"
What namespace do I call it if it has no namespace from the package?
Here's the original link to the composer package.
https://packagist.org/packages/infusionsoft/old-php-isdk
Am I missing something? Do I need to assign it a namespace? What and where would I put it?

Could not load type "sonata_simple_formatter_type"

I'm using Symfony framework and SonataBundle to build the admin application.
When I'm trying to setup a field with type blob and using the "sonata_simple_formatter_type" of SonataFormatterBundle, i was got the error:
Could not load type "sonata_simple_formatter_type"
Here is my composer.json file:
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
//*...*/
"sonata-project/admin-bundle": "2.3.10",
"sonata-project/doctrine-orm-admin-bundle": "2.3.3",
"sonata-project/user-bundle": "2.2.4",
"sonata-project/formatter-bundle": "2.3.3",
I was prefer to this link to making the admin app: sonata formatter
To fix the error, you also need to configure SonataFormatterBundle: https://sonata-project.org/bundles/formatter/master/doc/reference/installation.html
For the SonataAdminBundle you also need to do some extra configuration: https://sonata-project.org/bundles/formatter/master/doc/reference/formatter_widget.html#sonata-admin-integration

Symfony 3 / APCu + PHP7

I have a problem with APCu and PHP7 again.
Here is my conf.
framework:
validation:
cache: validator.mapping.cache.doctrine.apc
serializer:
cache: serializer.mapping.cache.apc
doctrine:
orm:
metadata_cache_driver: apcu
result_cache_driver: apcu
query_cache_driver: apcu
Website works ok, but when I send a form, I always get this error:
[2016-06-29 09:17:12] request.CRITICAL: Uncaught PHP Exception
Symfony\Component\Debug\Exception\UndefinedFunctionException:
"Attempted to call function "apc_fetch" from namespace
"Doctrine\Common\Cache"." at
ROUTE_TO_PROJECT/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php
line 41 {"exception":"[object]
(Symfony\Component\Debug\Exception\UndefinedFunctionException(code:
0): Attempted to call function \"apc_fetch\" from namespace
\"Doctrine\Common\Cache\". at
ROUTE_TO_PROJECT/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php:41)"}
[]
here is my composer:
"require": {
"php": ">=5.5.9",
"symfony/symfony": "3.0.*",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",
"knplabs/knp-paginator-bundle": "^2.5",
"liip/imagine-bundle": "^1.5",
"jms/serializer-bundle": "^1.1",
"symfony/assetic-bundle": "^2.8",
"gopay/payments-sdk-php": "^1.1",
"knplabs/knp-snappy-bundle": "~1.4",
"friendsofsymfony/user-bundle": "~2.0#dev"
Why is Symfony call apc_fetch instead apcu_fatch?
In previous versions of APCu, the APC module and functions were provided as part of the library.
In the most recent (PHP 7) versions of APCu, backward compatible APC is a separate extension.
This is my solution:
services.yml
serializer.mapping.cache.apcu:
class: Doctrine\Common\Cache\ApcuCache
confing_prod.yml
serializer:
cache: serializer.mapping.cache.apcu
Idk if this solution is ok, but looks like it works. So if you know better solution, I would like to use it.
You can get apcu working with symfony validation using the doctrine cache wrapper
config.yml
validation:
cache: validator.mapping.cache
services.yml
doctrine.apcu.cache:
class: Doctrine\Common\Cache\ApcuCache
validator.mapping.cache:
class: Symfony\Component\Validator\Mapping\Cache\DoctrineCache
arguments: ['#doctrine.apcu.cache']

Categories