public function handle(CreateBehaviorDO $do) { $entity = new Model(); $entity->store()->associate($this->loadStoreById($do->store_id)); $entity->name = $do->name; $entity->label = $do->label; $entity->save(); }
public function build(Model $entity = null) { $do = new DataObject(); if ($entity) { $entityData = $entity->toArray(); $entityData['attributes'] = $this->attributeBuilder->buildThem($entity->attributes); $do->update($entityData); } return $do; }