0
I beginner questions about inserting and removing using PDO in such relationships Onetomany and Manytomany. Example:
class Livro{
private $id;
private $titulo;
private $generos; //Livro tem mais de um genero
}
class Genero{
private $id;
private $nome;
}
The relationship is Onetomany, IE, a book has many genres. If in BD I have a Jointable (livro_genero
) how do I do the insert
using PDO? And if the relationship is Manytomany?
class Funcionario{
private $id;
private $nome;
private $projetos; //Um funcionario pode participar de vários projetos
}
class Projeto{
private $id;
private $titulo;
private $funcionarios; //Um projeto tem vários funcionarios
}
On the bench I have the tables funcionario
, projeto
and funcionario_has_projeto
.
PS: I cannot use Doctrine, so I would like examples of how to do this without using a ORM and using Mysql.
you want to simulate ORM behavior then?
– novic
Something like that.
– Sérgio Ramos da Silva