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.
Related
I need to create a dropdown in a Symfony form that contains entities from 2 different tables, for example:
Where EntityA and EntityB are two different classes and MySQL tables, with a different structure.
Is it possible to achieve this?
You should use the choice_loader option of a ChoiceType field.
You can use a CallbackChoiceLoader to load your entities through a closure or implement your own choice loader as a service that you can inject to your form type.
This allows you to build a custom query (or execute two queries in this case) and return the choice list built from the results lazily.
Check the official documentation here (https://symfony.com/doc/current/reference/forms/types/choice.html#choice-loader).
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.
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 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.
I'm customizing a SugarCRM 5, and in my SugarCRM database I have all invoices which were imported from our ERP. Now, I would like to know if it is possible to create a new sub-panel in the Accounts Panel without editing the original SugarCRM files, so that my client invoices index are visible in that interface.
Last time I checked, you could use the module builder to extend the interface. From 5.0 (or maybe 4.x) on, Sugar added all those APIs, which should enable you to extend SugarCRM without hacking it in and losing it with the next upgrade.
Hope that helps!
You can create a new module - Invoices using Module Builder and then add relations between Accounts and Invoices. The subpanels will appear for both - Accounts and Invoices without any coding. You should just customize the columns again using Module Builder.
as stated above, create invoices module to hold all your invoices, but before doing import make relationship with accounts and map the account field when importing so the invoice is automatically connect in subpanel and shown
Basically, the Account name should be a related field in your new invoices module (base the module creation on something like QUOTES that has similar fields. Once you create the module (so simple you can almost guess your way through it in the ADMIN section) and the fields you like (using Studio) just add the RELATED field Account Name and the sub-panel will be established in your ACCOUNTS module and the invoice will magically populate, especially if you re-install them using the import feature from a CSV file (spreadsheet).
You can create sub-panels in account modules details view by just giving relationship within two modules. Create a one-to-many relationship from Account module to Invoices module.