im have installed PropelBundle (1.2.0) for Symfnoy 2.3.
I set the configuration files as:
config.yml
propel:
path: "%kernel.root_dir%/../vendor/propel"
phing_path: "%kernel.root_dir%/../vendor/phing"
config_*.yml
propel:
dbal:
driver: %database_driver%
user: %database_user%
password: %database_password%
dsn: %database_driver%:host=%database_host%;dbname=%database_name%;%database_charset%
options: {}
attributes: {}
parameters.yml
parameters:
database_driver: mysql
database_host: 127.0.0.1
database_port: null
database_name: xxxxxxxxx
database_user: xxxxxxxxx
database_password: xxxxxxxxxxx
database_charset: UTF8
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
locale: en
secret: ThisTokenIsNotSoSecretChangeIt
And when i try execute the propel reverse engineering with:
rama#rastrojero:/var/www/AppManantiales$ php app/console
propel:reverse
The console returns:
Use connection named default in dev environment.
No generated files.
Any ideas ?
Edit: I install PropelBundle from Composer.
The database passsword was wrong. Thanks !
Related
i have an issue with doctrine and symfony4.1, he don't take my charset parameter.
I have always my tables with charset utf8 and collate utf8_unicode_ci.
I have tried with mariadb / mysql and nothing work he never detect my charset configuration.
I have drop my database, recreate and migrate mutiple times and clear cache everytime. But he doesn't work.
commands :
php bin/console doctrine:database:drop --force
php bin/console doctrine:database:create
php bin/console make:migration
php bin/console doctrine:migration:migrate
here my configuration file :
doctrine:
dbal:
driver: pdo_mysql
host: "%env(DATABASE_MASTER_HOST)%"
dbname: "%env(DATABASE_DBNAME)%"
user: "%env(DATABASE_USER)%"
password: "%env(DATABASE_PASSWORD)%"
slaves:
slave1:
host: "%env(DATABASE_SLAVE_HOST)%"
dbname: "%env(DATABASE_DBNAME)%"
user: "%env(DATABASE_USER)%"
password: "%env(DATABASE_PASSWORD)%"
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
dql:
string_functions:
GROUP_CONCAT: DoctrineExtensions\Query\Mysql\GroupConcat
IF: DoctrineExtensions\Query\Mysql\IfElse
FIND_IN_SET: App\DQL\FindInSet
When i add to my sql configuration file :
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
My database is created with utf8mb4_unicode_ci
but my tables is always generate with utf8 / utf8_unicode_ci
It work if i create my entity with the options parameter:
#ORM\Table(options={"charset":"utf8mb4"}...)
But i don't want to change all my table like that and my jointable are always with utf8.
why he don't take my configuration of charset.
It look likes something doens't work when i use MasterSlaveConnection.
Thanks a lot for your help.
I'm trying to install fosuserbudle and I was doing it step by step but with the documentation provided on github, I've that problem and I don't know how to fix it:
LENOVO#LENOVO-G500DC /c/wamp/www/pfe (master)
$ php app/console cache:clear
Fatal error: Class 'Symfony\Component\Console\Input\ArgvInput' not found in C:\w
amp\www\pfe\app\console on line 17
Call Stack:
0.0000 236552 1. {main}() C:\wamp\www\pfe\app\console:0
config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
framework:
#esi: ~
translator: ~
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
# handler_id set to null will use default session handler from php.ini
handler_id: ~
fragments: ~
http_method_override: true
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
# Assetic Configuration
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles: [ ]
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: "%kernel.root_dir%/Resources/java/compiler.jar"
#yui_css:
# jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
# Doctrine Configuration
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
#FOS UserBundle
fos_user:
db_driver: orm
firewall_name: main
user_class: Acme\UserBundle\Entity\User
You should update your question, but for your error SQLSTATE[HY000][2002] it is related with your database configuration. check if the port number is correct : 3306 and the host in your parameters.yml, and if that doesnt help show us your parameters.yml
Edit:
update your parameters.yml like this :
no brakets needed. and no comma need.
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: null
database_name: symfony
database_user: root
database_password: null
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
locale: en
secret: ThisTokenIsNotSoSecretChangeIt
database_path: null
I'm trying to integrate Sylius Product Bundle into my existing Symfony project. It already has doctrine configured.
This is the error I am getting:
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
The child node "driver" at path "sylius_attribute" must be configured.
Any idea what's causing this? I followed the instruction right off the bat without doing any other installations of sylius.
http://docs.sylius.org/en/latest/bundles/SyliusProductBundle/installation.html
I had to change the doctrine-bundle version in my composer.json file to allow the
composer require "sylius/product-bundle"
to run successfully without errors. I changed the version from 1.2.* to
"doctrine/doctrine-bundle": "1.3.*"
Also after composer installed these guys, i added the following to my config.yml file
sylius_product:
driver: doctrine/orm
classes:
product:
model: Sylius\Bundle\CoreBundle\Model\Product
controller: Sylius\Bundle\CoreBundle\Controller\ProductController
repository: Sylius\Bundle\CoreBundle\Repository\ProductRepository
stof_doctrine_extensions:
default_locale: es_us
translation_fallback: true
orm:
default:
tree: true
Initially I was getting the following error:
[Exception]
Missing parameter sylius.translation.default.mapping. Default translation mapping must be defined!
After a little searching around I added the piece below to the config.yml file
sylius_translation:
default_mapping:
translatable:
field: translations
currentLocale: currentLocale
fallbackLocale: fallbackLocale
translation:
field: translatable
locale: locale
Already existing earlier in my config.yml file was:
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
I didn't change anything in these settings.
What am i doing wrong here or missing? ANy help will be greatly appreciated.
Thanks!
EDIT
I tried adding all the below items:
sylius_attribute:
driver: doctrine/orm
sylius_variation:
driver: doctrine/orm
sylius_archetype:
driver: doctrine/orm
Now I get the following error:
[InvalidArgumentException]
The class sylius.model.product_archetype.class does not exist.
I added the corresponding file to the AppKernel with still no luck!
new Sylius\Bundle\AttributeBundle\SyliusArchetypeBundle(),
and then changed it to:
new Sylius\Bundle\ArchetypeBundle\SyliusArchetypeBundle(),
Setting up Sylius has been quiet stressful so far :(
I've updated the docs for the ProductBundle:
In composer.json you'll need to add these lines:
"require": {
...
"sylius/locale-bundle": "0.13.*",
"sylius/product-bundle": "0.13.*"
...
}
In app/AppKernel.php:
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle($this),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new Sylius\Bundle\ArchetypeBundle\SyliusArchetypeBundle(),
new Sylius\Bundle\AttributeBundle\SyliusAttributeBundle(),
new Sylius\Bundle\ProductBundle\SyliusProductBundle(),
new Sylius\Bundle\LocaleBundle\SyliusLocaleBundle(),
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
new Sylius\Bundle\TranslationBundle\SyliusTranslationBundle(),
new Sylius\Bundle\VariationBundle\SyliusVariationBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
In config.yml:
parameters:
sylius.locale: "%locale%"
sylius_archetype:
classes:
product:
subject: Sylius\Component\Product\Model\Product
attribute: Sylius\Component\Product\Model\Attribute
option: Sylius\Component\Product\Model\Option
archetype:
model: Sylius\Component\Product\Model\Archetype
repository: Sylius\Bundle\ResourceBundle\Doctrine\ORM\TranslatableEntityRepository
translatable:
targetEntity: Sylius\Component\Product\Model\ArchetypeTranslation
archetype_translation:
model: Sylius\Component\Product\Model\ArchetypeTranslation
sylius_attribute:
driver: doctrine/orm
sylius_product:
driver: doctrine/orm
sylius_locale:
driver: doctrine/orm
sylius_translation:
default_mapping:
translatable:
field: translations
currentLocale: currentLocale
fallbackLocale: fallbackLocale
translation:
field: translatable
locale: locale
sylius_variation:
driver: doctrine/orm
stof_doctrine_extensions:
orm:
default:
sluggable: true
timestampable: true
Now you should be able to run schema update successfully
$ php app/console doctrine:schema:update --dump-sql
If satisfied, execute:
$ php app/console doctrine:schema:update --force
Update: This configuration will break when upgrading to 0.14 (current released version is 0.13).
It wasn't mention on the tutorial you followed but I think it will help you :
https://github.com/Sylius/Sylius-Docs/blob/master/bundles/SyliusAttributeBundle/installation.rst#container-configuration
I'm trying to generate the schema of the database in a SQL Server database, using the following instruction: php app/console doctrine:schema:create.
This is the error message:
Call to undefined function Doctrine\DBAL\Driver\SQLSrv\sqlsrv_connect() in C:\Projects\Project\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\SQLSrvConnection.php
PARAMETERS FILE
parameters:
database_driver: pdo_sqlsrv
database_host: localhost
database_port: 1433
database_name: dbname
database_user: user
database_password: password
CONFIG FILE
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
#charset: UTF8
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
I guess you have NOT installed php plugin for that
My specific question: How can I troubleshoot a failure to create a database
using a Symfony2 parameters.ini file?
This has to do with Windows7 and Symfony2. I am trying to create a database
after configuring Symfony2, and I fail. (Details: I am working on Windows 7
64 bit, xampp 1.7.7 with PHP 5.3.8 and Symfony2 2.0.14).
When I try this from a command line:
php app/console doctrine:database:create
I get this:
Could not create database for connection named <comment>jobeet</comment>
SQLSTATE[28000] [1045] Access denied for user 'root'#'localhost' (using password: YES)
My parameters.ini file looks like this:
[parameters]
database_driver="pdo_mysql"
database_host="localhost"
database_port="3306"
database_name="jobeet"
database_user="root"
database_password="[intentionally left blank]"
mailer_transport="smtp"
mailer_host="localhost"
mailer_user=""
mailer_password=""
locale="en"
secret="[intentionally left blank]"
I can start MySql from the command line (mysqld --console), and get to MySql
as a root user (mysql -p[intentionally left blank] -u root) and create a
database (CREATE DATABASE test;), so I think my server is running and I can
use it.
I suspect the problem with "Access denied for user 'root'#'localhost'" has to
do with it not having the password for MySql root.
If anyone has ever run into this before, and knows what to do, your help
would be much appreciated.
I attempted to GRANT ALL PRIVILEGES with the following:
mysql> grant all privileges on *.* to 'root'#'localhost';
Query OK, 0 rows affected (0.05 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
I'm worried that is says '0 rows affected'. That can't be good.
Here is my config.yml. Plz let me know if you see problems.
imports:
- { resource: parameters.ini }
- { resource: security.yml }
framework:
#esi: ~
#translator: { fallback: %locale% }
secret: %secret%
charset: UTF-8
router: { resource: "%kernel.root_dir%/config/routing.yml" }
form: true
csrf_protection: true
validation: { enable_annotations: true }
templating: { engines: ['twig'] } #assets_version: SomeVersionScheme
session:
default_locale: %locale%
auto_start: true
# Twig Configuration
twig:
debug: %kernel.debug%
strict_variables: %kernel.debug%
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
# java: /usr/bin/java
filters:
cssrewrite: ~
# closure:
# jar: %kernel.root_dir%/java/compiler.jar
# yui_css:
# jar: %kernel.root_dir%/java/yuicompressor-2.4.2.jar
# Doctrine Configuration
doctrine:
dbal:
driver: %database_driver%
host: %database_host%
port: %database_port%
dbname: %database_name%
user: %database_user%
password: %database_password%
charset: UTF8
orm:
auto_generate_proxy_classes: %kernel.debug%
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
host: %mailer_host%
username: %mailer_user%
password: %mailer_password%
jms_security_extra:
secure_controllers: true
secure_all_services: false
You created a database named test, not jobeet.