Sonata sontauser and fosuser - php

I am trying to use sonata as my backed. I am now trying to set up some users.
I have installed the fosuserbundle but when I try to get sonata-project/user-bundle I get this:
Problem 1
- sonata-project/user-bundle 2.2.2 requires sonata-project/admin-bundle ~2.2.7 -> no matching package found.
- sonata-project/user-bundle 2.2.1 requires sonata-project/admin-bundle ~2.2.7 -> no matching package found.
- sonata-project/user-bundle 2.2.0 requires sonata-project/admin-bundle ~2.2.7 -> no matching package found.
- Installation request for symfony/framework-standard-edition 2.6.x-dev -> satisfiable by symfony/framework-standard-edition[2.6.x-dev].
- symfony/framework-standard-edition 2.6.x-dev requires sonata-project/user-bundle ~2.2 -> satisfiable by sonata-project/user-bundle[2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4].
- sonata-project/user-bundle 2.2.3 requires friendsofsymfony/user-bundle ~1.3 -> satisfiable by friendsofsymfony/user-bundle[1.3.x-dev].
- sonata-project/user-bundle 2.2.4 requires friendsofsymfony/user-bundle ~1.3 -> satisfiable by friendsofsymfony/user-bundle[1.3.x-dev].
- Conclusion: don't install friendsofsymfony/user-bundle 1.3.x-dev
I was looking at the sonata sandbox and in the AppKernel.php they have the following:
// USER
new FOS\UserBundle\FOSUserBundle(),
new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
new Application\Sonata\UserBundle\ApplicationSonataUserBundle(),
I can't find the requirement for FOSUserBundle in their composer file.
Can anyone explain to me what I am doing wrong? I just want to have a simple admin with user management so that I can have something that requires logged in users to access.
Using:
PHP 5.4.36-0+deb7u1 (cli)
Symfony 2.6.3
Thanks
UPDATE
I have followed HypeR suggestion and I now have the correct bundles.
There is a problem with the login. I have created the application bundle and it expects a fos_user_user table. How do I create this??
I try to login and get an error saying that the table fos_user_user does not exist.

You should follow the installation documentation on how to install SonataUserBundle.
To have user management, you need to install FosUserBundle. At the moment Sonata doesn't support the last version of FosUserBundle that's why you have to install the 1.3 version. There is more details about that on this issue.
Then you need to install the 2 dependencies of SonataUserBundle : SonataAdminBundle & SonataEasyExtendsBundle.
Then you can follow the install documentation of SonataUserBundle.
Good luck !
Update
It seems that your database is missing some tables, you should go in the root directory of your project and do in command line :
php app/console doctrine:schema:update --force
You can check the mysql queries that are about to be executed with the --force by using :
php app/console doctrine:schema:update --dump-sql
Check if you did all the steps of the installation of FOSUserBundle 1.3 : https://github.com/FriendsOfSymfony/FOSUserBundle/blob/1.3.x/Resources/doc/index.md

Related

Why can't I bind Elasticsearch and Laravel Scout?

I decided to test Elasticsearch in conjunction with Laravel Scout. I took this article as a basis
Attempt #1
composer require elasticsearch/elasticsearch - installing ES for Laravel
composer require laravel/scout - installing latest version for Scout (9.1)
composer require tamayo/laravel-scout-elastic - installing package for ES+Scout
I get this error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- tamayo/laravel-scout-elastic[8.0.0, ..., 8.0.2] require laravel/scout ^8.0 -> found laravel/scout[v8.0.0, ..., 8.x-dev] but it conflicts with your root composer.json require (^9.1).
- Root composer.json requires tamayo/laravel-scout-elastic ^8.0 -> satisfiable by tamayo/laravel-scout-elastic[8.0.0, 8.0.1, 8.0.2].
I understand for myself that this bundle package has not been updated on github for six months and it is necessary to get to it the necessary version of laravel/scout, so I change the order of actions and do so:
Attempt #2
composer require elasticsearch/elasticsearch - installing ES for Laravel
composer require tamayo/laravel-scout-elastic - installing this package hoping that he will get the necessary version of laravel/scout for himself as a dependency, in confirmation of this - I see in the console that he pulled up laravel/scout:8.6.1
Now no mistakes, I'm moving on:
I go to config/app.php and add:
Laravel\Scout\ScoutServiceProvider::class,
ScoutEngines\Elasticsearch\ElasticsearchProvider::class,
Run php artisan vendor:publish
And now I get new error:
Class 'ScoutElastic\ScoutElasticServiceProvider' not found
What am I doing wrong?
Solution: don't add ScoutEngines\Elasticsearch\Elastic search Provider:: class, to config/app.php
Everything works fine without adding this provider

Trying to install Cashier on Laravel 5.4.36

I am using Laravel 5.4.36 and I am trying to install Cashier using these steps: https://www.nicesnippets.com/blog/laravel-7-cashier-stripe-subscription-tutorial
However when I try to run this line:
sudo composer require laravel/cashier
I get this error:
Problem 1
- laravel/cashier[v12.6.0, ..., v12.6.1] require illuminate/contracts ^6.0|^7.0|^8.0 -> found illuminate/contra
cts[v6.0.0, ..., v6.20.7, v7.0.0, ..., v7.30.0, v8.0.0, ..., v8.19.0] but these were not loaded, likely because it
conflicts with another require.
- Root composer.json requires laravel/cashier ^12.6 -> satisfiable by laravel/cashier[v12.6.0, v12.6.1].
What am I doing wrong and how do I fix this?
Thanks,
When you do
composer require laravel/cashier
this will install the current version of the cashier package that works with the current version of Laravel. You have to check what version of cashier (if any), your current Laravel version installed, supports.

php symfony error mongoDB

I have problem with configuration MongoDB Symfony
Program doesnt see class \MongoDbBudle\ to I went to Tools ->
Composer -> add -> "doctrine/mongodb-odm". I tried to install it but I saw error:
C:\wamp64\bin\php\php7.0.10\php.exe C:\Users\Root\PhpstormProjects\untitled2\composer.phar require doctrine/mongodb-odm:1.2.x-dev -n --no-progress
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Removal request for alcaeus/mongo-php-adapter == 1.1.9999999.9999999-dev
- Removal request for alcaeus/mongo-php-adapter == 9999999-dev
- doctrine/mongodb-odm 1.2.x-dev requires doctrine/mongodb ^1.4.0 -> satisfiable by doctrine/mongodb[1.4.0].
- doctrine/mongodb 1.4.0 requires ext-mongo ^1.5 -> satisfiable by alcaeus/mongo-php-adapter[1.1.x-dev, dev-master].
- Installation request for doctrine/mongodb-odm 1.2.x-dev -> satisfiable by doctrine/mongodb-odm[1.2.x-dev].
To enable extensions, verify that they are enabled in your .ini files:
- C:\wamp64\bin\php\php7.0.10\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
php.ini seems to be ok. I added dynamic extension mongo-dll:
http://pastebin.com/bfb34A0s
Please help me how to solve this problem.
Using ODM with PHP 7 is a bit trickier than it should, please check if adding
"provide": {
"ext-mongo": "1.6.14"
}
to your project's composer.json would solve the issue. Otherwise you can see full chapter on how to use ODM with PHP 7 in the official documentation

how to solve composer minimum-stability

I'm trying to install Symfony CMF bundle.
I have installed SonataAdminBundle 3.x which requires SonataBlockBundle 3.x.
When installing SymfonyCMF bundle it requires symfoy-cmf/block-bundle 1.x, but this block-bundle requires SonataBlockBundle 2.5 or less.
I have fork the symfoy-cmf/block-bundle 1.x and change the requirement to 3.1 or less.
but I'm still getting following error
Problem 1
- symfony-cmf/block-bundle 1.3.0 requires sonata-project/block-bundle >=2.2.12,<2.5 -> satisfiable by
sonata-project/block-bundle[2.2.12, 2.2.13, 2.2.14, 2.2.15, 2.3.0,
2.3.1, 2.3.10, 2.3.11, 2.3.12, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9] but these conflict with your requirements or minimum-stability.
- symfony-cmf/symfony-cmf 1.3.0 requires symfony-cmf/block-bundle 1.3.* -> satisfiable by
symfony-cmf/block-bundle[1.3.0].
- Installation request for symfony-cmf/symfony-cmf ~1.3 -> satisfiable by symfony-cmf/symfony-cmf[1.3.0].
composar.json
...
"symfony-cmf/symfony-cmf": "~1.3",
"iBasit/block-bundle": "dev-master", // this is to replace sonata-cmf/block-bundle requirement
"sonata-project/block-bundle": "3.0.*",
...
We have got composer dependencies conflict.
I tried to use some ways
use minimum-stability section
use conflict section
install cmf first, before admin bundle
check ways you tried to do
I made all I knew about the area of your question and I dont see any decision right know.
The best way here is to use minimum-stability section to cmf bundle with "prefer-stable": true flag
I strongly not recommend you to make some changes like "I have fork the symfoy-cmf/block-bundle 1.x and change the requirement to 3.1 or less" because in future it can break dependencies and logic of bundles and it''s hardcode.
Thanks for attention, pls let me know if anyone find the decision of the problem.

hosting laravel 4 application in heroku

I have been receiving this error for quite sometime now. I have a laravel 4 application that I want to host in heroku. I have already created heroku application and now am trying to push my app to heroku using git push heroku master. The following are the results.
C:\xampp\htdocs\pos>git push heroku master
Fetching repository, done.
Counting objects: 83, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (59/59), done.
Writing objects: 100% (60/60), 342.76 KiB | 69.00 KiB/s, done.
Total 60 (delta 40), reused 0 (delta 0)
-----> Fetching custom git buildpack... done
-----> PHP app detected
Build dir is /tmp/build_5b1c5fb6-fa85-4a48-b2a8-127574aeb681
-----> Extracting Apache 2.4.7 PHP 5.5.9 build 2.0-rc1
-----> from http://vulcan-wlian.herokuapp.com/output/e33fbffa-c4ca-4752-8b1c-9ebc49366a1c
Creating Slug Identifier file with id: d325104734915692ee9e8f4189c08e21
Installing Composer binary
#!/usr/bin/env php
All settings correct for using Composer
Downloading...
Composer successfully installed to: /tmp/build_5b1c5fb6-fa85-4a48-b2a8-127574aeb681/bin/composer.phar
Use it: php bin/composer.phar
Installing Composer dependencies
Loading composer repositories with package information
Installing dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for barryvdh/laravel-migration-generator dev-master -> satisfiable by barryvdh/laravel-migration-generator[dev-master].
- barryvdh/laravel-migration-generator dev-master requires way/generators 1.x -> no matching package found.
Problem 2
- Installation request for zizaco/entrust dev-master -> satisfiable by zizaco/entrust[dev-master].
- zizaco/confide 2.0.0.b1 requires laravelbook/ardent 1.1.x -> satisfiable by laravelbook/ardent[v1.1.0].
- zizaco/confide 2.0.0a1 requires laravelbook/ardent 1.1.x -> satisfiable by laravelbook/ardent[v1.1.0].
- zizaco/confide 2.0.0b4 requires laravelbook/ardent 2.1.x -> satisfiable by laravelbook/ardent[v2.1.0].
- zizaco/confide 2.0.0b2 requires laravelbook/ardent 2.1.x -> satisfiable by laravelbook/ardent[v2.1.0].
- zizaco/confide 2.0.0b3 requires laravelbook/ardent 2.1.x -> satisfiable by laravelbook/ardent[v2.1.0].
- Can only install one of: laravelbook/ardent[v1.1.0, dev-master].
- Can only install one of: laravelbook/ardent[dev-master, v1.1.0].
- Can only install one of: laravelbook/ardent[v2.1.0, dev-master].
- Can only install one of: laravelbook/ardent[dev-master, v2.1.0].
- zizaco/entrust dev-master requires laravelbook/ardent dev-master -> satisfiable by laravelbook/ardent[dev-master].
- Conclusion: don't install laravelbook/ardent dev-master
- Installation request for zizaco/confide 2.0.x -> satisfiable by zizaco/confide[2.0.0.b1, 2.0.0a1, 2.0.0b2, 2.0.0b3, 2.0.0b4].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
! Push rejected, failed to compile PHP app
To git#heroku.com:ckpos.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:ckpos.git'
I have don't everything as required but with no success, any idea why?
Solved it. Simply switch back to the older buildpack.
Go to your app directory, where you do git push heroku master, and type:
heroku config:set BUILDPACK_URL=git://github.com/winglian/heroku-buildpack-php.git#mpm-event-php55-fpm
When I set the buildpack url to the master branch long ago, I had this funny feeling. I should have done this then. Anyways, a lesson learned.
Cheers!

Categories