How to store Propel objects into file? - file

I need to have option for Propel to store the data into database and file as well. Is there any way how to do that? I'll create the objects, fill the data and then need to store them into file (session) and be able to recreate the objects later. In some time it will go to database as well. Any idea?

I assume you could always create the object, fill some fields, and then serialize the object to a string, which you can save to a file. If you then deserialize this string, you get your original object. Watch out for references to objects or resources that can't be serialized, or should be re-created on serialization.
Once you get this working in one class, you can write a behavior (in Propel 1.5) that adds it to all your model classes.

Related

Is Firestore a good database for storing many large objects in?

I have been using React/Leaflet to create a choropleth map that can color any country on the map. What I am trying to do is to develop a save/load function that saves the colored countries and later be able to import it from the database. When this object is saved and loaded, it can bring back the exact same countries that were colored. I have been using firebase/firestore but I haven't been getting any luck.
This is how my object of map data looks like
Is Firestore the right database to do it? Or should I approach another database? I need a database that can store multiple objects in the picture above.
If you can convert that file into a JSON of a size smaller than 1MB, which is the Firestore Document size limit, it is possible. In the case you are proposing I would have the following structure, from the information you shared but fell free to adapt it as you see fit:
Map Collection
field1
...
fieldN
CountriesOptions Subcollection
optionObject: {}
Where each object is a separate document in the CountriesOptions subcollection converted to JSON using JSON.stringify(obj).
For more information on how to structure your Firestore with subcollections you can check this link to the documentation.

Flutter firestore overwrites data when I use set data

I have been trying to add data to sections in my firestorm database, I have a collection -> document -> data fields. Whenever I use setData({'key': 'value'}) is always overwrites the data already in the document. Is there anyway around this?
That is because what setData(object) is used for
To create or overwrite a single document
While update(object)
To update some fields of a document without overwriting the entire document
So what you need is to use update()
Using merge: true in your setData() statement prevents overwrite.
This seems similar to the update() method but you can use it even when document does not exist (ie is being created).

Selenium Webdriver- Which is the better way to get data from an external data file

I am just trying to login into a web application and filling out the input criteria(10 text fields) and clicking on submit.I am getting data from xml.
My doubt here is we can get input data from excel,xml,json,etc..But which is better,efficient and lightweight.Please suggest
You can use different approaches. For example:
If you want representation of object (you have object structure), you may store information in XML/json, load data into Entity and pass data into page using this Entity.
If you want just load data and don't want to use objects or your data unstructured (it can't be represented as object), you may use txt/csv/excel
something else (depends on your situation)

Does removing all data from a Sencha store also remove associated data?

I have a store and a model with a hasMany association.
If I call Ext.getStore('SessionStore').removeAll() does it also remove any associated data with the records in the store?
If not, how would I do this?
if you console log a record in SessionStore you should have a property with the name of the association plus the suffix Store
e.g. if the name of the association is personalInformation there should be a new property in the record called personalInformationStore.
So the answer would be yes by removing a record or all from a store the associated data will also be removed as this data is part of the parent object.
Perhaps Ext.StoreManager.getCount() can help validate the existence of the data / objects.
I also recommend this chrome extension: https://chrome.google.com/webstore/detail/app-inspector-for-sencha/pbeapidedgdpniokbedbfbaacglkceae?hl=en

Save error: Initial term of field expression must be a concrete SObject: MAP<String,AcctId__c>

I'm trying to get over a limitation in Salesforce where Lead objects can't have related lists that convert with the Lead over to Opportunity, Contact and Account. I have set up 4 objects of type Lookup Relationship, and created a dummy record in each.
I want to use Custom Settings to store the id of each of these dummy records, so that when the Lead converts, any custom objects can also convert to objects with Master/Detail relationships on the respective standard objects.
My trigger on Lead(after update) tries to create a Map of the Custom Settings:
Map cs = AcctId__c.getAll();
AcctId__c is the Custom Setting api name. Compile time is giving me the above message.
Now, I copied this code directly from the Salesforce documentation. What am I forgetting?
I believe that you must include the actual map definition <String,AcctId__c> after the word Map.
Check out this page.
http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_collections_maps.htm

Resources