Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I'm continuously getting the error: Drupal\Core\Config\Schema\SchemaIncompleteException: Incomplete or missing schema for mymodule.myentity.myentityname in Drupal\Core\Config\Entity\ConfigEntityBase->toArray() (line 248 of core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php).

Here is how I'd implemented the EntityForm:

class MymoduleForm extends EntityForm {
  public function form(array $form, array &$form_state) {
    $form = parent::form($form, $form_state);
    $entity = $form_state['entity'] = $this->getEntity();
    $form['name'] = array(
      '#type' => 'textfield',
      '#title' => t('Name'),
      '#default_value' => empty($entity->name) ? '' : $entity->name,
      '#required' => TRUE,
    );
    ...
    ...

    return $form;
  }
  public function validate(array $form, array &$form_state) {
    parent::validate($form, $form_state);
    $entity = $this->getEntity();
    //perform validation
  }
  public function save(array $form, array &$form_state) {
    $entity = $this->getEntity();
    $entity->save();
    print_r($entity);
    //throws error here

    $edit_link = \Drupal::linkGenerator()->generateFromUrl($this->t('Edit'), $this->entity->urlInfo());
  }

Doing a print_r($entity) shows two Object results: one showing all the values I'd filed up in the form and the other completely emplty.

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

That error has nothing to do with your form.

You need to provide a config schema for your config entity, see examples in node.schema.yml and many other places.

See also the configuration schema documetation.

share|improve this answer
    
Could provide an example? or a Tutorial link? I'm quite new to D8. –  xan Jul 6 at 13:41
    
@con_28 Giving a specific example isn't really possible as we don't know what fields your entity has. D8 is in alpha, so tutorials will be hard to come by. See node.type.* in core/modules/node/config/schema/node.schema.yml, comment.type.* in core/modules/comment/config/schema/comment.schema.yml for examples, after reading the docs Berdir linked to –  Clive Jul 6 at 14:18
1  
Oh wait, there's a fully-fledged config entity example in the Examples module, that should show you what's needed –  Clive Jul 6 at 14:21
    
@Clive: Thankyou. That was helpful. –  xan Jul 6 at 14:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.