Elasticquent icon indicating copy to clipboard operation
Elasticquent copied to clipboard

mappingProperties show no effect

Open katzefudder opened this issue 8 years ago • 3 comments

No matter what mappingProperties I define in my model, they're completely ignored. All types are strings. I have overwritten the addAllToIndex method to have fully control over things that happen when all things get indexed, no effect, all attributes are strings. ` protected $mappingProperties = [ 'created_at' => [ 'type' => 'date', "format" => "yyyy-mm-dd" ], ... ]; public static function addAllToIndex() { $instance = new static;

	$pictures = $instance->newQuery()->get(array('*'));
	
	foreach($pictures as &$picture) {
		$picture->created_at = (int)strtotime($picture->created_at);
		$picture->updated_at = (int)strtotime($picture->updated_at);
		$picture->gallery = Galleries::find($picture->galleries_id);
	}
	
	return $pictures->addToIndex();
}`

Migration is done via Blueprint like this: Schema::create('pictures', function (Blueprint $table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->integer('pages_id')->unsigned()->nullable(); ... );

Maybe, I'm mislead somewhere. Is someone willing to help? Thanks in advance!

katzefudder avatar Dec 01 '16 17:12 katzefudder

I have the same problem @timgws

chadidi avatar Dec 25 '17 23:12 chadidi

+1 any update on this? I have the same issue.

baj84 avatar May 24 '18 04:05 baj84

+1. I'm waiting too.

Smokietr avatar Jun 04 '20 01:06 Smokietr