Edit Symfony entity from the frontend - symfony

I have a Symfony app using multiple entities.
A third-party analytic tool plugs to my database to create reportings.
What I would like to achieve, is being able to update the Symfony entity from the frontend in order to add new fields to the database tables (in order to get the new fields showing up in the reporting tool).
Anyone has a idea on how to achieve that?
Thanks in advance.

If i understand correctly, you wan't to be able to add fields to your entity dynamicaly.
I don't know if this is doable and if so, it would probably be messy and unsecure.
What you can do however is using sub-entities with dynamic key => values fields.
You should have one main entity, an entity with the list of your dynamic fields, a many to many relation between your main entity and your fields entities and a third entity with the actual values from those fields.

Related

how to merge entity reference relationship field value

I am facing problem in drupal views.
In my view display table having relationship with other entity type.
I am not getting desire output. It show duplicate rows with same title due to entity relationship.
I wanted to aggregate entity relationship field with ",".
I already try some module like : view distinct, views_merge_rows.
But did not work for me.
Please suggest some module.
Have a look at Views Calc and if you cant do it in the database Views Aggregator Plus gives you even more options.

CakePHP model behaviors in Symfony2 + Doctrine2?

Is it possible to have behaviors in Symfony 2 entities, like in CakePHP? I'll try to explain what I need:
In some of my entities, I need to store who created or updated the record, when it was created or updated, at which company does it belongs and at which season does it belongs.
All these data is stored in the session, and I want to add it to the entity "magically", without adding these fields in the controller. With CakePHP I can create SeasonBehavior, mark some models/entities as they use the SeasonBehavior and when I persist a record from an entity marked with the SeasonBehavior the seasonId is updated.
Is it possible to do the same with Symfony2 and Doctrine 2? And if it's possible, do you know any tutorial or documentation explaining how to do this?
You need to create listener on your Persist action to do such things. Read the manual here: http://symfony.com/doc/current/cookbook/doctrine/event_listeners_subscribers.html

Can I get a DbList from a string of the name of the entity?

I am builing a ui query builder with Entity Framework. I was thinking of letting the user choose a base entity type from a drop down list of entities, then populate a grid view as test. If you select this entity, your basic result will be the contexts of this grid view. Later I will add the ability to 'Include' other entities and filter. But for now I can't even get the basics. I have a drop down of all entities. But I do not see how to get a generic list based on the name of the entity. I think I need to use reflection, but can't figure that out. I can get this easily if I hard code the entity type, but that does not solve my problem.
I have DbContext set up, using entity Framework 5, and want the results on a ASP .Net webforms page.

How to embed form in in sonata admin-generator of symfony2 bundle

I am using sonata-admin generator for one of my project.
I want to create a form which contains fields from two tables User and User_add.
My tables are like this:
USER: id,name,age,login_id,pwd,create_at,updated_at
USER_ADD: id,user_id(FK from user),add_type,street,city,state,country,pin.
Now I want a single form so that, I should be able to insert data for both user as well as user_add using sonata admin generator.
Please suggest me some link if, I can get answer of this doubt.
Thanks in advance.
Please check http://forum.symfony-project.org/viewtopic.php?t=38120, it describes doctrine one-to-one relation between item and itemDetail and how to use sonata_type_admin to have a possibility to create itemDetail from item form.

umbraco and custom system table

I have the following scenario:
My website db has a system table called "Companies", which includes an id field, companyName field, and companyImageUrl field.
How do I set up an umbraco document type for adding entries to this table ?
Maybe I shouldn't use a custom table at all ?
Thanks.
As far as I know, Umbraco doesn't support what you want to do out of the box (mapping a document type to a table that isn't part of the umbraco core).
One approach that might work is to create an action handler that syncs a Company doc type to your table when creating a node of that type.
It's a bit of a hack though. I've found that I've very rarely needed to create custom tables. What exactly are you trying to do with it? My guess is that you don't really need it and would be better off working with a doc type instead. Umbraco provides a variety of ways to get and act upon doc types from within custom C# code (check out the umbraco.NodeFactory namespace). You'll also get the added benefit of being able to easily interact with these nodes from XSLT/Razor.

Resources