Is there a way of declaring a field of any type?
Nothing seems to be documented, so I tried
foo: {
type: undefined
blackbox: yes
}
My issue:
When I run an update on the collection, it works for scalar values. But if foo is an array, what gets saved is an array of nulls.
I narrowed the issue down to the simple-schema declaration of foo. As a temporary work-around, I've disabled the use of this schema branch for now (blackbox-ed the parent of foo).
Is there a more proper way of declaring the schema for field foo?
No, it's not currently possible:
https://github.com/aldeed/meteor-simple-schema/issues/174
You can try using the blackbox option:
https://github.com/aldeed/meteor-simple-schema#blackbox
Related
Is it possible to sort by a resolved property in HotChocolate? A resolved property can be an arbitrary expression, even some LINQ expression, which I set up in an ObjectType<T>-derived class:
descriptor
.Field("MyResolvedField")
.Type<StringType>()
.IsProjected(false)
.Resolve((context, ct) =>
{
//definition goes here
});
I tried to set up a SortInputType<T>-derived class and on the Configure method explicitly mention my resolved field as:
descriptor.BindFieldsExplicitly();
descriptor.Field("MyResolvedField");
But this always fails with an exception.
Is this even possible at all? If so, how?
When I run a build with stencil, I get
[Warn]
The #Prop() name "title" is a reserved public name. Please rename the "title"
prop so it does not conflict with an existing standardized prototype member.
Reusing prop names that are already defined on the element's prototype may
cause unexpected runtime errors or user-interface issues on various browsers,
so it's best to avoid them entirely.
I know it's only a warning but since it may cause unexpected runtime errors, I was wondering if some standard for naming it already existed. (since title was for me the more obvious propriety name to use).
If not, what would be the best practice?
title is a global html attribute name - 'reserved'. See https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes. As a best practice, you shouldn't use global attribute names for #Props. I don't know of any 'standard' for naming a property which is the title of your component but isn't the same as the global title attribute (which is usually used for the tooltip).
As of today, the only workaround I found was to add attributes as property and pass all the information through this variable, like the following
attributes: {
title: string
description: string
/** ... */
}
I didn't found better than that.
But I'm still open to any ideas
Properties and component attributes are strongly connected but not necessarily the same thing.
We cannot use the title variable because of the HTMLElement prop type, but we can set the field text as title like this
#Prop({ attribute: 'title' }) heading?: string;
For example:
public function getField() {
return ucfirst($this->field);
}
Given that an entity has getters that do some changes on the database value before returning it, how can those changes also be applied when using the getArrayResult() method ?
For example, Laravel has accessors (http://laravel.com/docs/5.0/eloquent#accessors-and-mutators). The entity getter can be used in the same way.
When using getArrayResult(), the value for the "field" will not have the first character capitalized.
Thank you!
Well, it's the same behaviour as laravel almost :)
Take a look at Hydrators
.
Hydrators are the processors that bind your raw db output to various data types in doctrine. Thus you have Doctrine_Core::HYDRATE_RECORD which is the standard hydrator(aka the thing called when you use $query->getResult()).
If you use $query->getArrayResult(), it uses the Doctrine_Core::HYDRATE_ARRAY Hydrator.
If you need a more detailed description, please let me know.
I am a Java developer who tries Flex. Here is my problem:
I behave actionScript objects as hashmap but when the object do not have the property it gives exception: No such variable.
Here I expect it gave me null, instead of giving exception. So do you know is there a way to handle it, namely check if the property is defined for object.
trace( obj["2008-02"] ) // gives exception
Use something along the lines of
if (myObject.hasOwnProperty("propertyName"))
to check if the property exists.
Edit: Also take a look here.
hasOwnProperty() doesn't work correctly with inheritance, static properties, or dictionaries.
You should use
if ("propertyName" in myObject)
instead.
try
if ( obj["2008-02"] != null ) { then do something }
it is null, but you can't output null. you can also try converting it to a string for the purposes of a trace().
I use the aldeed:collection2 package, and I attached a schema to my Meteor collection. It automatically performs data validation upon every insert/update. However, before inserting anything into the collection, it simply removes data fields that weren't declared in the schema.
I know I can turn this off by specifying filter: false:
MyCollection.insert(newDocument, { filter: false });
But I want it to be turned off by default, so I won't accidentally screw up my database by forgetting to update my schema.
How to turn off data filtering by default?
The .clean method gets always called, as stated in the SimpleSchema docs, therefore I don't think it's possible to disable that by default as you are asking:
NOTE: The Collection2 package always calls clean before every insert, update, or upsert.