How to update an existing entity in nopCommerce 2.5 (MVC)?
I did makes changes to class under Nop.Data > Mapping folder. But it does not created the column to database after I run the application. Is there anything else I need to do?
This is the resource created by the Nop team to guide you through updating the solution/entity
http://www.nopcommerce.com/docs/73/updating-an-existing-entity-how-to-add-a-new-property.aspx
add new property in Nop.Core\Domain folder.
Note: Nop.Data > Mapping is for mapping between your table and your entity classes.
Add new column in your table manually.
Manually add column in table is necessary.
Change your Controller and View as per your requirement.
If you want to get to more detail about Add Custom Field In NopCommerce Table
Related
I have an application with products and attributes. In the backoffice I would like to track the changes on the attribute values. I started using loggable extension by gedmo and it works fine but now I'd like to add a new column in the log entry table for the product id.
I know how to create a custom entity for the logs by adding the annotation in the attribute table:
#Gedmo\Loggable(logEntryClass="App\Entity\LogEntry")
But I don't know if is somehow possible to extend the Gedmo listener to also log the product_id in the log entry table
I found the solution:
https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/advanced.html#overriding-the-listeners
With this its easy to use a custom logger
Currently, I'm working on Sylius framework. I need to override a few fields from Base models. It can be like changing field type, or changing field length, add null/not null/unique condition etc. How can we override this without touching core files Or ignoring existing fields and creating new fields with a similar name?
Not suggest to change the field type but create a new one.
But if you really want to make change, I guess should be similar to create a new field?
Have a check on the official doc:
http://docs.sylius.com/en/1.2/customization/model.html
a customer has an existing database. The schema is often changed within the database itself (e.g. he adds a new column).
My task is to develop an admin area with symfony that automatically reacts on table schema changes without modifying the application code. E.g. the customer adds a new column to table "MyEntity", and the application automatically generates a new column in the accordingly list view.
My approach is to dynamically map the table columns to the Entity class so that ALL Attributes and ALL Getters/Setters are generated dynamically from the table schema.
So is it possible to map the table columns in a Doctrine Entity without the use of Annotations or XML Files.
Something like:
class MyEntity{
public function generateMappingFromSchema($sTableName){...}
}
Please don't do that. Doctrine was not designed for such use case.
There is a library though you should check https://github.com/laravel-doctrine/fluent which basically is a mapping driver that allows you to manage your mappings in an Object Oriented approach. And there are other tools:
http://crud-admin-generator.com/
http://crudkit.com/
http://www.grocerycrud.com/
which are maybe better for that, I don't know.
But again, please don't do that. Do not allow the customer to modify the database schema or give them e.g. a phpMyAdmin which was designed for that.
I'm setting up a blog using Asp.net MVC3 and Entity framework 4. Most of the properties of the blog post already exist in the database, and therefore can easily be linked to the blog post during the creation.
One of the last element I've added are sources, these sources have a direct link to my BlogPost and have to be added during the creation of the BlogPost. My idea was to use the entity property Sources of the BlogPost entity, like:
blogPost.Sources.Add(new Source() { Name = source.Value, Url = source.Key.ToString(), Type = "source" });
Unfortunately I'm not allowed to create and add an Source this way, I'm getting the error: "Cannot insert explicit value for identity column in table 'Source' when IDENTITY_INSERT is set to OFF."
I guess this is cause of the ID column which has is an Identity with Identity increment turned on, but I don't set any ID myself. I tried to make id = null, but since its not a null-able it's not allowed either.
I believe turning this feature off let's me add records with my own ID's, but this is not what I want. The database should create the ID's.
Is there a way to add these kinds of properties during creation?
I solved the problem by adding the Source entity again from the database, apparently the entity framework model was generated before the field was set to Identity Increasing and therefore wanted to insert it's own ID's.
I am developing project with symfony 1.4 using sfguard plugin and propel orm. I have some tables related to sf_guard_user table. I have to show these tables all together on admin interface. But sfguard plugin only allow adding one table which is named as sfuserprofile. When I created this table, I can reach the columns of this tables from generator.yml.
But I have to add so many data to database which is related to user such as location, detailed address, tel numbers and of course all of associated tables. I can not store all of them on sfuserprofile table. I have create some tables such as user_profile, user_address_details, user_album_images etc. But I could not integrate all of these tables except user_profile table to generator file.
I have red the read me file but I could not find any clues. Is it possible adding another table column to sfguard generator file.
Edit:
The solution is merging the target form classes in userprofile form class.
Either use partials (fields defined with _ in front of them) or define getters in you sfGuardUser model for each field you want to display. More information http://www.symfony-project.org/book/1_2/14-Generators (look for Custom Fields and Partial Fields).
That is a symfony 1.2 documentation. Some of the things are different in symfony 1.4, but it's enough info there to get you going on the right track.