EXTBASE: An object of class "Tx_Extbase_Persistence_ObjectStorage" could not be converted to a plain value - typo3

After saving a model with a 1:n relation in the extension builder, this error shows up:
An object of class "Tx_Extbase_Persistence_ObjectStorage" could not be converted to a plain value.
What needs to be set in the extension builder to fix it?

In the extension builder for that model, the value of Object type needs to be set to Entity instead of Value object.
Or in your generated model class check if it extends Tx_Extbase_DomainObject_AbstractEntity.

Related

How code generate from protege data property with getter single value instead collection?

I have a simple model in protege of class and data property.
But when I use code generator - in generated class - property getter have type - Collection< String > instead simple String.
I try to add something like with different types predicate in class:
"title some xsd:string"
But it is Collection yet.
Is it can be done in protege and how? May be example ontology?

Adding custom Class to CoreData

I need to add a class to my CoreData model. This class has a custom class from the Heimdall Swift library (https://github.com/henrinormak/Heimdall) as a Member.
How can I add this custom class to my CoreDataModel?
It depends what you mean by adding a custom class:
If you want to add a class that represents an entity, you need to design the class so that it inherits from NSManagedObject. You can't add an arbitrary class as one of the entities in the data model-- the inheritance is mandatory.
If you want to add an instance of the class as an attribute of an entity, you need to be able to convert that class to/from NSData so that Core Data will be able to save it. A good way to do this is to make the class conform to the NSCoding protocol and then use the "transformable" type for the Core Data attribute.

Realm class name different from Stored Name in DB

So I am having naming conflicts in my code.
I have
struct LocationMessage {}
and
class LocationMessageRLM : Object {}
Is there an annotation or configuraiton option that will allow my LocationMessageRLM object to be stored in a table called LocationMessage
No, sorry. Realm generates the object schema for each table at runtime based off the class names of every Object subclass. There are no configuration options to change this behaviour.
If you're not happy about the name of the Realm object table, it might be worth considering renaming the struct instead (Sorry if that was really obvious!).

Swift Core Data: auto-generating managed object subclass makes the class name to PRODUCT_MODULE_NAME.entityName in model

I'm making a purely Swift project, and when I create an entity in model file, then use Editor->Create NSManagedObject Subclass to create class file for the entity, in the model, the Class property for entity becomes PRODUCT_MODULE_NAME.entityName, this will cause core data to fail loading NSManagedObject subclass instance.
I know how to get pass by this by using #objc() and rename the class property in model file, but is there any better idea?
Two options:
Replace the PRODUCT_MODULE_NAME with the value of this build setting. By default, it will be the same as your TARGET_NAME. The full value in the Class field should be something like MyApp.entityName.
Use only entityName in the Class field and prefix your swift class with #objc(entityName)
The representedClassName field in the data model appears to be evaluated at runtime so it needs a literal value.

iPhone Coredata saving error

I'm trying to create core data application.
Some times when trying to save data, i'm seeing following error:
Error: NSInvalidArgumentException,
Reason: * -_referenceData64 only defined for abstract class. Define -[NSTemporaryObjectID_default _referenceData64]!,
Description: * -_referenceData64 only defined for abstract class. Define -[NSTemporaryObjectID_default _referenceData64]!
I didn't understand why this error is coming and how to avoid it. Can some one help me please.
Edit: The original answer below is technically correct but doesn't accurately describe the true source of the error. The runtime can't find the correct attribute but the reason it can't find it is because the entity exist in another managed object context. The OP probably never had a _referenceData64 attribute for any of his entities.
See: http://www.cocoadev.com/index.pl?TemporaryObjectIdsDoNotRespondToReferenceData
Original Answer:
You have a class that has an attribute _referenceData64. In the data model, that class is marked as "abstract'. Select the entity in data model editor and check the box below that says "abstract". If it is checked, then that is your problem.
An abstract entity is never instantiated. Unless is has a subclass, you can't actually set its attributes to any value. Abstract entities just exist to provide templates for subclasses.