I'm new to the whole pimcore thing. I am trying to play around and create classes. The issue is, I am not able to create more than 1 class, and in the database it is nameless, so when I try to create another class, it also tries to store it in the database with no name, which ends up showing an SQL error saying that there is a duplicate entry. Any ideas what the reason behind this could be?
I installed pimcore on an nginx server, I am trying to create classes by choosing Settings->Objects->Classes and then "Add Class", creating the first class was ok, I entered a name for the class and it was successfully added, however the name field in the corresponding database entry is empty, as in empty string ' '. So, when I try to add another class and pimcore attempts to store it in the table "classes", it returns an error saying that it would be a duplicate entry since they both are nameless, i.e. the name entered isn't added. The following error is what I managed to find using developer tools, could be helpful.
[WARN] Unable to parse the JSON returned by the server
minified_javascript_core_f5757da….js?_dc=3708:5684 Error: You're trying to decode an invalid JSON String:
Fatal error: Call to a member function hasChilds() on null in /var/www/html/pimproject/pimcore/modules/admin/controllers/DocumentController.php on line 59
at new Ext.Error (http://192.10.0.0/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:27054)
at Function.Ext.apply.raise (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:27447)
at Object.Ext.raise (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:27594)
at Object.Ext.JSON.me.decode (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:385102)
at Ext.define.onProxyLoad (http://192.10.0.10/website/var/tmp/minified_javascript_core_f5757da9fa29d5bf13e6aa5058eff9f7.js?_dc=3708:5641:28)
at Ext.cmd.derive.triggerCallbacks (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:594533)
at Ext.cmd.derive.setCompleted (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:594231)
at Ext.cmd.derive.setException (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:594444)
at Ext.cmd.derive.process (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:593638)
at Ext.cmd.derive.processResponse (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:648303)
Just reinstall Pimcore.
It can be some composer or submodules error.
I strongly recommend for the first installation to run Demo project https://github.com/pimcore/demo not Skeleton, especially if you are using Docker. Later, when you will get the feeling of Pimcore, feel free to install Skeleton or any other project.
Pimcore is stable working for years. If you had some problems before -- nowadays, it is stable.
Related
I am using python to automatically populate a MySQL DB. The script that populates the DB (/path/to/pythonScript.py very long) is actually called by another python script (example below) works fine and I have added a few statements that prevent me from inserting duplicated entries.
When I try to insert a duplicated entry with the script /path/to/pythonScript.py I get (as expected)
ProgrammingError: 1061 (42000): Duplicate key name 'unique_index'
In order to deal with that, I want to write a try except statement while calling the /path/to/pythonScript.py script, as shown below:
import mysql.connector
from mysql.connector.errors import ProgrammingError
# Here I have already successfully connected to the DB, and populated it
try:
get_ipython().system("ipython /path/to/pythonScript.py") # this is the script that populates the DB. It does not allow the insertion of duplicated entries
except ProgrammingError:
print("a warning message informing that I am trying to insert a duplicated entry")
When I call the script for the first time, everything goes well (after all, the DB was empty). But then when I call the script for the second time (i.e. when I attempt to insert duplicated entries) I am still getting the same error ProgrammingError: 1061 (42000): Duplicate key name 'unique_index'
I have found this documentation page where they show examples on how to handle errors, though there is no example specifically on the ProgrammingError. In this other documentation page there is one example on the ProgrammingError, though they skipped the imports section and I am afraid I am missing something by the import (note that I don't get any error when I call from mysql.connector.errors import ProgrammingError)?
You are running the other script as a distinct process. Exceptions only exist within the current process - FWIW, you could be running a shell script or a C-coded binary app instead, it would be just the same.
I kindly suggest you momentarily ditch IPython and take a couple days doing the full official Python tutorial, paying particular attention to the parts about functions and modules. Then you may want to rewrite your first script to make it a proper module with proper functions (I assume from your question and example code it's currently a plain script with everything at the top-level - but I may be wrong of course ;) ), then rewrite your calling script to import functions from the first one and call them.
Also note that that ProgrammingError can happen for a whole lot of other reasons than a duplicate key, so you MUST check the exception's code to find out which exact error happened.
I have been getting this annoying exception while trying to create a native query with my entity manager. The full error message is:
java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: com.model.OneToManyEntity2#61f3b3b.
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.discoverUnregisteredNewObjects(RepeatableWriteUnitOfWork.java:313)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.calculateChanges(UnitOfWorkImpl.java:723)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:441)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:874)
at org.eclipse.persistence.internal.jpa.QueryImpl.performPreQueryFlush(QueryImpl.java:967)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:207)
at org.eclipse.persistence.internal.jpa.QueryImpl.getSingleResult(QueryImpl.java:521)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getSingleResult(EJBQueryImpl.java:400)
The actual code that triggers the error is:
Query query;
query = entityManager.createNativeQuery(
"SELECT MAX(CAST(SUBSTRING_INDEX(RecordID,'-',-1) as Decimal)) FROM `QueriedEntityTable`");
String recordID = (query.getSingleResult() == null ?
null :
query.getSingleResult()
.toString());
This is being executed with an EntityTransaction in the doTransaction part. The part that is getting me with this though is that this is the first code to be executed within the doTransaction method, simplified below to:
updateOneToManyEntity1();
updateOneToManyEntity2();
entityManager.merge(parentEntity);
The entity it has a problem with "OneToManyEntity1" isn't even the table I'm trying to create the query on. I'm not doing any persist or merge up until this point either, so I'm also not sure what is supposedly causing it to be out of sync. The only database work that's being done up until this code is executed is just pulling in data, not changing anything. The foreign keys are properly set up in the database.
I'm able to get rid of this error by doing as it says and marking these relationships as Cascade.PERSIST, but then I get a MySQLContrainstraViolationException on the query.getSingleResult() line. My logs show that its doing some INSERT queries right before this, so it looks like its reaching the EntityManager.merge part of my doTransaction method, but the error and call stack point to a completely different part of the code.
Using EclipseLink (2.6.1), Glassfish 4, and MySQL. The entitymanager is using RESOURCE_LOCAL with all the necessary classes listed under the persistence-unit tag and exclude-unlisted-classes is set to false.
Edit: So some more info as I'm trying to work through this. If I put a breakpoint at the beginning of the transaction and then execute entityManager.clear() through IntelliJ's "Evaluate Expression" tool, everything works fine at least the first time through. Without it, I get an error as it tries to insert empty objects into the table.
Edit #2: I converted the nativeQuery part into using the Criteria API and this let me actually make it through my code so I could find where it was unintentionally adding in a null object to my entity list. I'm still just confused as to why the entity manager is caching these errors or something to the point that creating a native query is breaking because its still trying to insert bad data. Is this something I'd need to call EntityManager.clear() before doing each time? Or am I supposed to call this when there is an error in the doTransaction method?
So after reworking the code and setting this aside, I stumbled on at least part of the answer to my question. My issue was caused by the object being persisted prior to the transaction starting. So when I was entering my transaction, it first tried to insert/update data from my entity objects and threw an error since I hadn't set the values of most of the non-null columns. I believe this is the reason I was getting the cascade errors and I'm positive this is the source of the random insert queries I saw being fired off at the beginning of my transaction. Hope this helps someone else avoid a lot of trouble.
Using PhalconPHP framework
I have been using ACL successfully for a while but ran into an issue when I tried using an action name that was more than 16 characters long. When I add adminChangePassword as an access under my users resource | get the error
Access 'adminChangePassw' does not exist in resource 'users'
#0 [internal function]: Phalcon\Acl\Adapter\Memory->_allowOrDeny('Administrators', 'users', 'adminChangePass...', 1)
But using the name adminChangePassw works fine (apart from that it is a rubbish name). It appears that the name is being truncated at some point which I presume would be a bug.
Is that what is happening or can anyone give another explanation of this error?
A quick test
I've just tried adding an access in the users resource called 12345678901234567 and the error says that 1234567890123456 does not exist - truncating the last 7...
Occurs in tutorial programs
I tried adding 'adminChangePassword' to the ACL in my working Vokuro example and get the same error - so it isn't related to any changes I have made to how the ACL works.
This is because I had been working from the Vokuro example code - the database for which limits the size of the action and resource fields to 16 characters. Changing the database setup to allow more characters in those fields fixes the problem.
I am trying to import in Magento using Magmi a set of configurable and simple products. I have followed all the necessary steps correctly (I guess) that are described here http://wiki.magmi.org/index.php?title=Configurable_Item_processor.
Here is a test file with data that I load in the importer https://docs.google.com/spreadsheets/d/17_fWYfYmSiXdLYp80P0kafPrFYzwzp7JHGNlHQTM0S4/edit?usp=sharing
Test cases:
Running the import without Configurable Item processor works just fine but does not create the link between the simple products and the configurable ones in backend (which makes perfect sense).
Running with Configurable Item processor with all the combinations of plugin options (Perform simples/configurable link y/n & auto match simples skus before configurable y/n) yields all the time the fallowing errors:
1 SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'attribute_id' cannot be null -
2 SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'attribute_id' cannot be null - ERROR ON RECORD #3
The error is triggered by this line of code
INSERT INTO `catalog_product_super_attribute` (`product_id`,`attribute_id`,`position`) VALUES (?,?,?)
that you can find in /plugins/base/itemprocessors/configurables/magmi_configurableprocessor.php:246
I have searched for a solution and found this one http://blog.mdnsolutions.com/index.php/magmi-not-importing-configurable-products/ where actually the guy solved the issue by replacing that line above with:
INSERT INTO `catalog_product_super_attribute` (`product_id`,`attribute_id`,`position`) VALUES (:a,:b,:c)
It is not working.
There is also another question on this issue posted here Magmi Configurable Products Importation however the solution appears to be very "vague".
Working with:
Magento - 1.9.0.1
Magmi - 0.7.20
Configurable Item processor - 1.3.7a
OS is Ubuntu running PHP 5.3.10 & MySQL 5.5.34
Some thoughts based on my experience:
Are any of your attributes mandatory? I suggest putting something into the size column for the configurable product.
For visibility, I use numeric values. For configurable products it should be 4, for simple products it should be 1 (you don't want them to be visible individually, rather you want them to be visible within the configurable products).
Finally, how are you creating your csv files? If just with excel, you may get problems with the encoding and how it separates fields. I run my csv files through openoffice calc to make the files UTF-8 and the text fields are properly handled.
Just ran into the exact same problem. Simples work, but configurables don't even with the exact same information/etc.
As it would turn out if there is a wrong "configurable_attributes" named attribute with a simple it still goes.
Example
_attribute_set,type,configurable_attributes,size_option,color,
"Default",simple,"color,size","Small","Gold"
No error
_attribute_set,type,configurable_attributes,size_option,color,
"Default",configurable,"color,size","Small","Gold"
Error
Turns out "color,size" was not matching to actual attribute names.
Was "color,size_option".
Check your attributes
I am using Hibernate3 with spring application.
I introduced a column in my existing table with many to one relationship with the addition in the .hbm file as mentioned below:
<many-to-one name="qualityStatus" column="quality_status"
class="model.PurchaseStatus" lazy="false" fetch="join"/>
The corresponding object to this hbm has a property of type 'PurchaseStatus' and field name as 'qualityStatus'.
Now when i try fetching the data from the table representing the above object with the query:
List<Long> dnIds = session.createQuery("select dnItem.dnId from DeliveryNoteItem dnItem where dnItem.qualityStatus!=? and dnItem.qualityStatus!=? and dnItem.qualityStatus!=?")
.setInteger(0,1)
.setInteger(1,5)
.setInteger(2,7)
.list();
i get an error saying as 'java.sql.Exception: Unknown column 'deliveryno0_.quality_status' in 'where clause'
I get this error when deployed on test server but when i check the same thing on my local server i works fine as well when i just run this query directly on the database on the test server it returns me result. So it confirms that the database on the test server is alright. It is only when it executes through the application on the test server i am getting this error.
Can anybody let me know what can be the reason or how do i debug this out.
Thanks in advance. Looking forward for replies.
If you really have a quality_status column in your database, then you should make sure you have the most recent version of your application deployed on the test server, and make sure that the connection url of hibernate really points to the test database.
This is not a hibernate problem, not a programming one. It is environmental - check your configurations and redeploy.