Error when writing attribute
Permalink
I have a php page in which I am checking that if all data has been filled. If any haven't, I am repopulating the data and coloring the input for ease of interaction. This works fine.
Once all data is input, I am pushing data to the user attributes. When I do this, I get the following error:
An unexpected error occurred.
Entity of type Concrete\Core\Entity\Attribute\Value\UserValue is missing an assigned ID for field 'attribute_key'. The identifier generation strategy for this entity requires the ID field to be populated before EntityManager#persist() is called. If you want automatically generated identifiers instead you need to adjust the metadata mapping accordingly.
The log shows:
Exception Occurred: /public_html/concrete/vendor/doctrine/orm/lib/Doctrine/ORM/ORMException.php:87 Entity of type Concrete\Core\Entity\Attribute\Value\UserValue is missing an assigned ID for field 'attribute_key'. The identifier generation strategy for this entity requires the ID field to be populated before EntityManager#persist() is called. If you want automatically generated identifiers instead you need to adjust the metadata mapping accordingly. (0)
Anyone experienced this and know what I may be doing wrong?
Once all data is input, I am pushing data to the user attributes. When I do this, I get the following error:
An unexpected error occurred.
Entity of type Concrete\Core\Entity\Attribute\Value\UserValue is missing an assigned ID for field 'attribute_key'. The identifier generation strategy for this entity requires the ID field to be populated before EntityManager#persist() is called. If you want automatically generated identifiers instead you need to adjust the metadata mapping accordingly.
The log shows:
Exception Occurred: /public_html/concrete/vendor/doctrine/orm/lib/Doctrine/ORM/ORMException.php:87 Entity of type Concrete\Core\Entity\Attribute\Value\UserValue is missing an assigned ID for field 'attribute_key'. The identifier generation strategy for this entity requires the ID field to be populated before EntityManager#persist() is called. If you want automatically generated identifiers instead you need to adjust the metadata mapping accordingly. (0)
Anyone experienced this and know what I may be doing wrong?
So I'm doing some tests. I commented out where i am writing the attributes. Looks like it works if I do that. Allowing the first to be written also works. I will add them one by one to see which is the problem!
So I've tested the following 2 lines:
These don't trigger an error, but it's also not writing data.
$q1 and $q2 are the following:
I'm checking data is posted and !empty($q1) and it seems to be correct. I put in a "echo 'Success'; to test if the condition is working, and it is. But no data is being written! Is this related to the main issue I am having?
$ui->setAttribute('Q1', $q1); $ui->setAttribute('Q2', $q2);
These don't trigger an error, but it's also not writing data.
$q1 and $q2 are the following:
$q1 = $_POST["q1"];$q2 = $_POST["q2"];
I'm checking data is posted and !empty($q1) and it seems to be correct. I put in a "echo 'Success'; to test if the condition is working, and it is. But no data is being written! Is this related to the main issue I am having?
Error in an attribute name. Fixed.