When I log out and try to log back in again, it gives me the same error:
(An exception occurred while executing ‘INSERT INTO fos_user (username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, dn, code_utilisateur) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [“riemann”, “riemann”, “riemann#ldap.forumsys.com”, “riemann#ldap.forumsys.com”, 1, null, “”, “2018-05-23 21:26:15”, null, null, “a:1:{i:0;s:9:\”ROLE_USER\”;}”, “uid=riemann,dc=example,dc=com”, null]:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicata du champ ‘riemann#ldap.forumsys.com’ pour la clef ‘UNIQ_957A6479A0D96FBF’)
As if it is trying to insert at the places to update the user.
You need to change the order of the chain providers.
providers: [fos_userbundle, fr3d_ldapbundle]
Related
I am working on Sylius 1.2.8. I have overridden Product model and it is working fine but when I add a new product with attributes:
<?php
...
$em = $this->container->get('sylius.manager.product');
/**
* #var \Sylius\Component\Product\Model\ProductAttributeValueInterface $attribute
* #var \Sylius\Component\Core\Model\ProductInterface $product
*/
$product->addAttribute($attribute);
$em->persist($product);
$em->flush();
It throws this error:
An exception occurred while executing 'INSERT INTO
sylius_product_attribute_value (locale_code, text_value,
boolean_value, integer_value, float_value, datetime_value, date_value,
json_value, product_id, attribute_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?,
?, ?)' with params ["en_US", null, null, null, null, null, null,
"[\"013ea12a-1aff-4050-8107-20b53ada73ce\"]", null, 28]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'product_id' cannot be null
My custom Product Model looks like this:
namespace AppBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Sylius\Component\Core\Model\Product as BaseProduct;
class Product extends BaseProduct implements ProductInterface
{
public function __construct()
{
parent::__construct();
}
}
And my config file:
sylius_product:
driver: doctrine/orm
resources:
product:
classes:
repository: AppBundle\Doctrine\ORM\ProductRepository
model: AppBundle\Entity\Product
I have found a similar question asked :stackoverflow.com/q/22919004/6248367. But this does not solve my problem neither does it answer why application fails. This answer is also 4 years old. Can someone help me fix this?
Edit: This error is also thrown in admin whenever I create a new product and add attributes to it at the same time. Workaround is to first create product, then add attributes.
I have figured out the problem. As #czende mentioned properly check the configuration.
In my case I had set the wrong class in subject while overriding the attribute:
sylius_product:
driver: doctrine/orm
resources:
product:
classes:
repository: AppBundle\Doctrine\ORM\ProductRepository
model: AppBundle\Entity\Product
sylius_attribute:
driver: doctrine/orm
resources:
product:
# Make sure to provide the correct Product class in the subject.
subject: AppBundle\Entity\Product
attribute:
classes:
model: AppBundle\Entity\ProductAttribute
repository: AppBundle\Doctrine\ORM\ProductAttributeRepository
Also make sure to use mappedSuperclass in the mapping config instead of entity as commented by Michał Marcinkowski in issue #3997
AppBundle\Entity\ProductAttribute:
type: mappedSuperclass
table: sylius_product_attribute
EDIT: To debug what's wrong, start by checking warnings in symfony debug bar. It can narrow down your search area for bug. It can also hint you if something is wrong in your configuration file.
We are trying to use Flyway to manage our database schema updates with the following spring-boot configuration:
spring:
datasource:
driver-class-name: oracle.jdbc.OracleDriver
password: ${java_user_password}
url: ${DB_URL}
username: JAVA_USER
flyway:
locations: classpath:/db/migration
user: SUPER_USER
password: ${password_of_super_user}
baseline-on-migrate: true
url: ${DB_URL}
schema: JAVA_USER
Flyway version 5.1.4.
The configuration is working in Oracle 12.1.0.2.0 Standard Edition but not in Enterprise edition. We keep getting the following error:
SQL State : 42000
Error Code : 955
Message : ORA-00955: name is already used by an existing object
Line : 17
Statement : CREATE TABLE "JAVA_USER"."flyway_schema_history" (
"installed_rank" INT NOT NULL,
"version" VARCHAR2(50),
"description" VARCHAR2(200) NOT NULL,
"type" VARCHAR2(20) NOT NULL,
"script" VARCHAR2(1000) NOT NULL,
"checksum" INT,
"installed_by" VARCHAR2(100) NOT NULL,
"installed_on" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
"execution_time" INT NOT NULL,
"success" NUMBER(1) NOT NULL
)
Any idea why? Before starting the spring-boot application we delete all objects under the schemas.
Thanks!
I am exploring the option of using SyliusRbacBundle for my app. I manage to install it along with FosUserBundle. When I got to the setup part I got the following error on running the command 'sylius:rbac:initialize' following the instructions found here: http://docs.sylius.org/en/latest/bundles/SyliusRbacBundle/setup.html#setup-roles-and-permissions-in-the-database
Initializing Sylius RBAC roles and permissions.
Adding permission "Update product". (app.product_update)
Adding permission "Create product". (app.product_create)
Adding permission "Manage product". (app.product_manage)
[Doctrine\DBAL\DBALException]
An exception occurred while executing 'INSERT INTO sylius_role (code, name,
description, security_roles, tree_left, tree_right, tree_level, created_at
, updated_at, parent_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params
["root", "Root", null, "a:0:{}", null, null, null, "2015-05-11 16:45:34",
"2015-05-11 16:45:34", null]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'tree_left' ca
nnot be null
[PDOException]
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'tree_left' ca
nnot be null
sylius:rbac:initialize
This is how my config.yml looks like:
sylius_rbac:
driver: doctrine/orm
security_roles:
ROLE_ADMINISTRATION_ACCESS: Can access backend
roles:
app.admin:
name: Administrator
description: Administrator
app.product_manager:
name: Product Manager
description: muchos productos
permissions: [app.product_update, app.product_create]
roles_hierarchy:
app.admin: [app.product_manager]
permissions:
app.product_update: Update product
app.product_create: Create product
app.product_manage: Manage product
permissions_hierarchy:
app.product_manage: [app.product_create, app.product_update]
Any one has a clue how to solve it?
Thanks!
The Sylius/Rbac uses the tree behaviour from the Atlantic18/DoctrineExtensions.
You can use this in a Symfony system using the stof/StofDoctrineExtensionsBundle.
Once it has been installed you would need to enable the tree behaviour in your app/config/config.yml like..
stof_doctrine_extensions:
orm:
default:
tree: true
This should make the listener register correctly and then your fields to be auto-populated.
When implementing the following user story with the most recent version of FOSUserBundle (dev-master), instead of the form being invalidated because the passwords don't match, the data attempted to get persisted and fails because the passwords transformed to null values.
Why does this occur?
Feature Scenario:
Scenario: Trying to register with non verified password
Given I am on the "Login" page
And I follow "Sign Up"
When I fill in the following:
| Email | foo#bar.com |
| Username | jdoe |
| Password | bar |
| Verification | foo |
And I press "Register"
Then I should be on the Registration page
And I should see "The entered passwords don't match"
Error:
An exception occurred while executing 'INSERT INTO user_account (username, username_canonical, email, email_canonical, enabled, salt, password, last_login, locked, expired, expires_at, confirmation_token, password_requested_at, roles, credentials_expired, credentials_expire_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["jdoe", "jdoe", "foo#bar.com", "foo#bar.com", 1, "9z59n57td20cs88kw8gg8css80g0css", null, null, 0, 0, null, null, null, "a:0:{}", 0, null]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'password' cannot be null
This occurs if you are using the Symfony 2.4 Validation API with newer versions of FOSUserBundle, which has recently started using the new Validation API introduced in Symfony 2.5.
The Validation API version may have been explicitly defined in app/config/config.yml as a workaround for a bug in Symfony 2.5 that affected the UniqueEntity constraint on the User model (ie. signing up with the same email address): https://github.com/FriendsOfSymfony/FOSUserBundle/issues/1516#issuecomment-47204302
validation:
enabled: true
enable_annotations: true
api: 2.4 # remove this line to fix the issue
I successfully managed to write deployer extension as well as storage extension.
And below are the logs which I took from core logs, which shows everything is loaded perfectly!!
2013-01-08 11:30:19,759 INFO BundleConfigurationLoader - Added 'PublishAction' for storage 'persistence' with 'com.tridion.storage.dao.JPAPublishActionDAO'.
2013-01-08 11:30:38,259 DEBUG JPAPublishActionDAO - Constructor of JPAPublishActionDAO- storageId:searchdb
2013-01-08 11:30:38,259 DEBUG JPAPublishActionDAO - Constructor of JPAPublishActionDAO- entityManagerFactory:true
2013-01-08 11:30:38,259 DEBUG JPAPublishActionDAO - Constructor of JPAPublishActionDAO- storageName:PublishAction
2013-01-08 11:19:38,400 INFO Module - No TransformProcessor configured, will not transform files before deployment for module com.tridion.custom.extensions.SearchPageDeployer
2013-01-08 11:30:38,400 DEBUG SearchPageDeployer - Constructor of SearchPageDeployer //This is my PageDeployer Constructor
2013-01-08 11:30:38,744 DEBUG SearchPageDeployer - Called processPage from SearchPageDeployer //This is my process Page of pagedeployer class
2013-01-08 11:30:38,572 DEBUG SearchPageDeployer - SearchPageDeployer Called processItem
2013-01-08 11:30:38,572 DEBUG StorageManagerFactory - Default storage provider has caching set to: false
2013-01-08 11:30:38,572 DEBUG StorageManagerFactory - Loaded following dao Properties[publication=0, typeMapping=PublishAction, storageId=searchdb, cached=false] for publication/typeMapping/itemExtension: 0 / PublishAction / null
2013-01-08 11:30:38,572 DEBUG StorageManagerFactory - Loading a non cached DAO for publicationId/typeMapping/itemExtension: 0 / PublishAction / null
2013-01-08 11:30:38,572 DEBUG StorageManagerFactory - Wrapping DAO's, currently 0 wrappers installed
2013-01-08 11:30:38,572 INFO JPAPublishActionDAO - Entering Method: JPAPublishActionDAO.PublishAction.store
2013-01-08 11:40:33,228 ERROR SearchPageDeployer - SearchPageDeployer - Exception occurred com.tridion.broker.StorageException: Unable to persist data entity, Error while commiting the transaction, Error while commiting the transaction
Now when I am trying to store the data in my table I am getting "Exception occurred com.tridion.broker.StorageException: Unable to persist data entity, Error while commiting the transaction, Error while commiting the transaction"
is this any issue with my Entity class or something I am missing.
EDIT: After the enable logger level "ON" in logback xml.
I got below exception in core files:
2013-01-08 14:42:10,713 DEBUG SQL - insert into AUTN_ITEMS (ACTION, FLAG, ITEM_TYPE, LAST_PUBLISHED_DATE, PUBLICATION_ID, SCHEMA_ID, TCMURI, URL, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
2013-01-08 14:42:10,728 DEBUG AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2013-01-08 14:42:10,744 DEBUG JDBCExceptionReporter - could not insert: [com.tridion.storage.dao.PublishAction] [insert into AUTN_ITEMS (ACTION, FLAG, ITEM_TYPE, LAST_PUBLISHED_DATE, PUBLICATION_ID, SCHEMA_ID, TCMURI, URL, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?)]
com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert explicit value for identity column in table 'AUTN_ITEMS' when IDENTITY_INSERT is set to OFF.
Thanks
The error you're getting is suggesting that your ID column is not defined correctly as an identity or that you're trying to manually set a value to the autogenerated value in this column.
Hope this helps.
Regards,
Daniel.
The ID column should be set to auto increment at db level. Have a look at my original article on sdltridionworld for an example http://www.sdltridionworld.com/articles/sdltridion2011/tutorials/extending-content-delivery-storage-sdltridion-2011-1.aspx
"For SQL Server, column ID is defined as IDENTITY(1,1), so it increments automatically by one, without us having to specify value.
For Oracle, column ID needs to be defined using a Sequence (that generates the values), like this:
CREATE SEQUENCE SEQ_PUBLISH_ACTIONS MAXVALUE 999999999999999 CYCLE START WITH 1
/
CREATE OR REPLACE TRIGGER PUBLISH_ACTIONS_KEY
BEFORE INSERT ON PUBLISH_ACTIONS
FOR EACH ROW
BEGIN
IF :new.ID IS NULL THEN
SELECT SEQ_PUBLISH_ACTIONS.NEXTVAL INTO :new.ID FROM DUAL;
END IF;
END;
/
"
Above issue was in my Entity Class, I need to add below annotations for my identity column.
#Id
#Column(name = "ID", unique=true,updatable=false,insertable=false)
#GeneratedValue(strategy = GenerationType.AUTO)
private long id;
Please do suggest if any changes are required.
Thanks