⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

set_relation_n_n



fkrul
  • profile picture
  • Member

Posted 19 May 2015 - 16:43 PM

Sorry, I do not speak English, my set_relation_n_n , is generating a field like that of Category in http://www.grocerycrud.com/examples/set_a_relation_n_n example , I would like to generate an equal Actors , with two columns . Below my sql tables involved.

CREATE TABLE url(
  pk_url int(11) NOT NULL AUTO_INCREMENT,
  url_controller_action varchar(250) not null,
  url_aplicacao_fk INT(11) NOT NULL,
  FOREIGN KEY (url_aplicacao_fk) REFERENCES aplicacao(pk_aplicacao)
    ON DELETE NO ACTION ON UPDATE NO ACTION,
  PRIMARY KEY (pk_url)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE permissao_grupo(
  pk_permissao_grupo INT(11) NOT NULL AUTO_INCREMENT,
  permissao_grupo_url_fk INT(11) NOT NULL,
  permissao_grupo_grupo_fk INT(11) NOT NULL,
  FOREIGN KEY (permissao_grupo_url_fk) REFERENCES url(pk_url)
    ON DELETE NO ACTION ON UPDATE NO ACTION,
  FOREIGN KEY (permissao_grupo_grupo_fk) REFERENCES grupo(pk_grupo)
    ON DELETE NO ACTION ON UPDATE NO ACTION,
  PRIMARY KEY(pk_permissao_grupo),
  UNIQUE(permissao_grupo_url_fk,permissao_grupo_grupo_fk)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE grupo(
  pk_grupo int(11) NOT NULL AUTO_INCREMENT,
  grupo_descricao varchar(100) NOT NULL,
  grupo_aplicacao_fk int(11) NOT NULL,
  FOREIGN KEY (grupo_aplicacao_fk) REFERENCES aplicacao(pk_aplicacao)
    ON DELETE NO ACTION ON UPDATE NO ACTION,
  PRIMARY KEY (pk_grupo)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

            $crud->set_relation_n_n('urls', 'permissao_grupo', 'url', 'permissao_grupo_url_fk', 'permissao_grupo_grupo_fk', 'url_controller_action',null,null);
 

 

 


Paul Savostin
  • profile picture
  • Member

Posted 02 June 2015 - 11:33 AM

Not exactly understand you asking for. Try to extend your question with example pls