I read the cakephp documentation but can’t find a way to migrate the models from my 2.6 Application to cakephp 3.8. I want to migrate my app, but the new model structure is completely diferent.
Example:
I have a model called Aluno that references a table alunos in my database with this content:
<?php
class Aluno extends AppModel{
public $name = 'Alunos';
public $order = 'Aluno.aluno ASC';
public $validate = array(
'aluno' => array(
'required' => true
)
);
public $belongsTo = array(
'Cidade' => array(
'className' => 'Cidade',
'foreignKey' => 'cidade_id',
'fields' => array('Cidade.id','nome','estado_id'),
'conditions' => array(),
'order' => array('Cidade.id' => 'ASC'),
'dependent' => true
),
'Bairro' => array(
'className' => 'Bairro',
'foreignKey' => 'bairro_id',
'fields' => array('Bairro.id','Bairro.nomebairro'),
'conditions' => array(),
'order' => array('Bairro.id' => 'ASC'),
'dependent' => true
),
'Sexo' => array(
'className' => 'Sexo',
'foreignKey' => 'sexo_id',
'fields' => array('Sexo.id','Sexo.sexo'),
'conditions' => array(),
'order' => array('Sexo.id' => 'ASC'),
'dependent' => true
),
'Naciopai' => array(
'className' => 'Nacionalidade',
'foreignKey' => 'nacionalidade_id',
'fields' => array('Naciopai.id','Naciopai.nome'),
'conditions' => array(),
'order' => array('Naciopai.id' => 'ASC'),
'dependent' => true
),
'Naciomae' => array(
'className' => 'Nacionalidade',
'foreignKey' => 'nacionalidade2_id',
'fields' => array('Naciomae.id','nome'),
'conditions' => array(),
'order' => array('Naciomae.id' => 'ASC'),
'dependent' => true
),
'Cor' => array(
'className' => 'Cor',
'foreignKey' => 'cor_id',
'fields' => array('Cor.id','Cor.cor'),
'conditions' => array(),
'order' => array('Cor.cor' => 'ASC'),
'dependent' => true
),
'EscolaTransporte' => array(
'className' => 'EscolaTransporte',
'foreignKey' => 'escola_transporte_id',
'fields' => array('EscolaTransporte.id','EscolaTransporte.transpescola'),
'conditions' => array(),
'order' => array('EscolaTransporte.transpescola' => 'ASC'),
'dependent' => true
),
'User' => array(
'className' => 'User',
'foreignKey' => 'User_id',
'fields' => array('User.id','User.nome', 'User.username'),
'conditions' => array(),
'order' => array('User.nome' => 'ASC'),
'dependent' => true)
);
}
?>
How can I migrate this to 3.8 model format?
P.S.- Sorry for my bad english…