Lançado Adianti Framework 7.6!
Clique aqui para saber mais
Erro cadastro Pessoal estou numa fase péssima, por gentileza estou fazendo testes de cadastro para implementar em um sistema que estou fazendo. Eu fiz um cadastro pelo Studio e está apresentando um erro, onde não existe nem o campo que ele apresenta, eu não estou conseguindo enxergar onde está o erro, segue o código e campos: Model: CompFam ...
MO
Erro cadastro  
Fechado
Pessoal estou numa fase péssima, por gentileza estou fazendo testes de cadastro para implementar em um sistema que estou fazendo. Eu fiz um cadastro pelo Studio
e está apresentando um erro, onde não existe nem o campo que ele apresenta, eu não estou conseguindo enxergar onde está o erro, segue o código e campos:

Model: CompFam

  1. <?php
  2. /**
  3.  * CompFam Active Record
  4.  * @author  <your-name-here>
  5.  */
  6. class CompFam extends TRecord
  7. {
  8.     const TABLENAME 'comp_fam';
  9.     const PRIMARYKEY'id';
  10.     const IDPOLICY =  'serial'// {max, serial}
  11.     
  12.     
  13.     private $tipo_nec_esp;
  14.     private $ocupacaoprof;
  15.     private $escolaridade;
  16.     private $titulars;
  17.     private $estado_civil;
  18.     private $sitconjugal;
  19.     private $situacao_trab;
  20.     private $beneficio;
  21.     private $tempo_trabalho;
  22.     private $grauparent;
  23.     private $renda_mensal;
  24.     /**
  25.      * Constructor method
  26.      */
  27.     public function __construct(2579 NULL$callObjectLoad TRUE)
  28.     {
  29.         parent::__construct(2579$callObjectLoad);
  30.         parent::addAttribute('compf_nome');
  31.         parent::addAttribute('compf_Idade');
  32.         parent::addAttribute('compf_renda');
  33.         parent::addAttribute('compf_valbenef');
  34.         parent::addAttribute('compf_localtrabalho');
  35.         parent::addAttribute('compf_titular_id');
  36.         parent::addAttribute('compf_renda_comp_id');
  37.         parent::addAttribute('compf_situacaotrab_id');
  38.         parent::addAttribute('compf_escolaridade_id');
  39.         parent::addAttribute('compf_ocupacaoprof_id');
  40.         parent::addAttribute('compf_tipo_nec_esp_id');
  41.         parent::addAttribute('compf_tempo_trabalho_id');
  42.         parent::addAttribute('compf_renda_mensal_id');
  43.         parent::addAttribute('compf_grauparent_id');
  44.         parent::addAttribute('compf_estado_civil_id');
  45.         parent::addAttribute('compf_sitconjugal_id');
  46.         parent::addAttribute('compf_qualnecespecial');
  47.     }
  48.     
  49.     /**
  50.      * Method set_tipo_nec_esp
  51.      * Sample of usage: $comp_fam->tipo_nec_esp = $object;
  52.      * @param $object Instance of TipoNecEsp
  53.      */
  54.     public function set_tipo_nec_esp(TipoNecEsp $object)
  55.     {
  56.         $this->tipo_nec_esp $object;
  57.         $this->tipo_nec_esp_id $object->id;
  58.     }
  59.     
  60.     /**
  61.      * Method get_tipo_nec_esp
  62.      * Sample of usage: $comp_fam->tipo_nec_esp->attribute;
  63.      * @returns TipoNecEsp instance
  64.      */
  65.     public function get_tipo_nec_esp()
  66.     {
  67.         // loads the associated object
  68.         if (empty($this->tipo_nec_esp))
  69.             $this->tipo_nec_esp = new TipoNecEsp($this->tipo_nec_esp_id);
  70.     
  71.         // returns the associated object
  72.         return $this->tipo_nec_esp;
  73.     }
  74.     
  75.     
  76.     /**
  77.      * Method set_ocupacaoprof
  78.      * Sample of usage: $comp_fam->ocupacaoprof = $object;
  79.      * @param $object Instance of Ocupacaoprof
  80.      */
  81.     public function set_ocupacaoprof(Ocupacaoprof $object)
  82.     {
  83.         $this->ocupacaoprof $object;
  84.         $this->ocupacaoprof_id $object->id;
  85.     }
  86.     
  87.     /**
  88.      * Method get_ocupacaoprof
  89.      * Sample of usage: $comp_fam->ocupacaoprof->attribute;
  90.      * @returns Ocupacaoprof instance
  91.      */
  92.     public function get_ocupacaoprof()
  93.     {
  94.         // loads the associated object
  95.         if (empty($this->ocupacaoprof))
  96.             $this->ocupacaoprof = new Ocupacaoprof($this->ocupacaoprof_id);
  97.     
  98.         // returns the associated object
  99.         return $this->ocupacaoprof;
  100.     }
  101.     
  102.     
  103.     /**
  104.      * Method set_escolaridade
  105.      * Sample of usage: $comp_fam->escolaridade = $object;
  106.      * @param $object Instance of Escolaridade
  107.      */
  108.     public function set_escolaridade(Escolaridade $object)
  109.     {
  110.         $this->escolaridade $object;
  111.         $this->escolaridade_id $object->id;
  112.     }
  113.     
  114.     /**
  115.      * Method get_escolaridade
  116.      * Sample of usage: $comp_fam->escolaridade->attribute;
  117.      * @returns Escolaridade instance
  118.      */
  119.     public function get_escolaridade()
  120.     {
  121.         // loads the associated object
  122.         if (empty($this->escolaridade))
  123.             $this->escolaridade = new Escolaridade($this->escolaridade_id);
  124.     
  125.         // returns the associated object
  126.         return $this->escolaridade;
  127.     }
  128.     
  129.     
  130.     /**
  131.      * Method addTitular
  132.      * Add a Titular to the CompFam
  133.      * @param $object Instance of Titular
  134.      */
  135.     public function addTitular(Titular $object)
  136.     {
  137.         $this->titulars[] = $object;
  138.     }
  139.     
  140.     /**
  141.      * Method getTitulars
  142.      * Return the CompFam' Titular's
  143.      * @return Collection of Titular
  144.      */
  145.     public function getTitulars()
  146.     {
  147.         return $this->titulars;
  148.     }
  149.     
  150.     /**
  151.      * Method set_estado_civil
  152.      * Sample of usage: $comp_fam->estado_civil = $object;
  153.      * @param $object Instance of EstadoCivil
  154.      */
  155.     public function set_estado_civil(EstadoCivil $object)
  156.     {
  157.         $this->estado_civil $object;
  158.         $this->estado_civil_id $object->id;
  159.     }
  160.     
  161.     /**
  162.      * Method get_estado_civil
  163.      * Sample of usage: $comp_fam->estado_civil->attribute;
  164.      * @returns EstadoCivil instance
  165.      */
  166.     public function get_estado_civil()
  167.     {
  168.         // loads the associated object
  169.         if (empty($this->estado_civil))
  170.             $this->estado_civil = new EstadoCivil($this->estado_civil_id);
  171.     
  172.         // returns the associated object
  173.         return $this->estado_civil;
  174.     }
  175.     
  176.     
  177.     /**
  178.      * Method set_sitconjugal
  179.      * Sample of usage: $comp_fam->sitconjugal = $object;
  180.      * @param $object Instance of Sitconjugal
  181.      */
  182.     public function set_sitconjugal(Sitconjugal $object)
  183.     {
  184.         $this->sitconjugal $object;
  185.         $this->sitconjugal_id $object->id;
  186.     }
  187.     
  188.     /**
  189.      * Method get_sitconjugal
  190.      * Sample of usage: $comp_fam->sitconjugal->attribute;
  191.      * @returns Sitconjugal instance
  192.      */
  193.     public function get_sitconjugal()
  194.     {
  195.         // loads the associated object
  196.         if (empty($this->sitconjugal))
  197.             $this->sitconjugal = new Sitconjugal($this->sitconjugal_id);
  198.     
  199.         // returns the associated object
  200.         return $this->sitconjugal;
  201.     }
  202.     
  203.     
  204.     /**
  205.      * Method set_situacao_trab
  206.      * Sample of usage: $comp_fam->situacao_trab = $object;
  207.      * @param $object Instance of SituacaoTrab
  208.      */
  209.     public function set_situacao_trab(SituacaoTrab $object)
  210.     {
  211.         $this->situacao_trab $object;
  212.         $this->situacao_trab_id $object->id;
  213.     }
  214.     
  215.     /**
  216.      * Method get_situacao_trab
  217.      * Sample of usage: $comp_fam->situacao_trab->attribute;
  218.      * @returns SituacaoTrab instance
  219.      */
  220.     public function get_situacao_trab()
  221.     {
  222.         // loads the associated object
  223.         if (empty($this->situacao_trab))
  224.             $this->situacao_trab = new SituacaoTrab($this->situacao_trab_id);
  225.     
  226.         // returns the associated object
  227.         return $this->situacao_trab;
  228.     }
  229.     
  230.     
  231.     /**
  232.      * Method set_beneficio
  233.      * Sample of usage: $comp_fam->beneficio = $object;
  234.      * @param $object Instance of Beneficio
  235.      */
  236.     public function set_beneficio(Beneficio $object)
  237.     {
  238.         $this->beneficio $object;
  239.         $this->beneficio_id $object->id;
  240.     }
  241.     
  242.     /**
  243.      * Method get_beneficio
  244.      * Sample of usage: $comp_fam->beneficio->attribute;
  245.      * @returns Beneficio instance
  246.      */
  247.     public function get_beneficio()
  248.     {
  249.         // loads the associated object
  250.         if (empty($this->beneficio))
  251.             $this->beneficio = new Beneficio($this->beneficio_id);
  252.     
  253.         // returns the associated object
  254.         return $this->beneficio;
  255.     }
  256.     
  257.     
  258.     /**
  259.      * Method set_tempo_trabalho
  260.      * Sample of usage: $comp_fam->tempo_trabalho = $object;
  261.      * @param $object Instance of TempoTrabalho
  262.      */
  263.     public function set_tempo_trabalho(TempoTrabalho $object)
  264.     {
  265.         $this->tempo_trabalho $object;
  266.         $this->tempo_trabalho_id $object->id;
  267.     }
  268.     
  269.     /**
  270.      * Method get_tempo_trabalho
  271.      * Sample of usage: $comp_fam->tempo_trabalho->attribute;
  272.      * @returns TempoTrabalho instance
  273.      */
  274.     public function get_tempo_trabalho()
  275.     {
  276.         // loads the associated object
  277.         if (empty($this->tempo_trabalho))
  278.             $this->tempo_trabalho = new TempoTrabalho($this->tempo_trabalho_id);
  279.     
  280.         // returns the associated object
  281.         return $this->tempo_trabalho;
  282.     }
  283.     
  284.     
  285.     /**
  286.      * Method set_grauparent
  287.      * Sample of usage: $comp_fam->grauparent = $object;
  288.      * @param $object Instance of Grauparent
  289.      */
  290.     public function set_grauparent(Grauparent $object)
  291.     {
  292.         $this->grauparent $object;
  293.         $this->grauparent_id $object->id;
  294.     }
  295.     
  296.     /**
  297.      * Method get_grauparent
  298.      * Sample of usage: $comp_fam->grauparent->attribute;
  299.      * @returns Grauparent instance
  300.      */
  301.     public function get_grauparent()
  302.     {
  303.         // loads the associated object
  304.         if (empty($this->grauparent))
  305.             $this->grauparent = new Grauparent($this->grauparent_id);
  306.     
  307.         // returns the associated object
  308.         return $this->grauparent;
  309.     }
  310.     
  311.     
  312.     /**
  313.      * Method set_renda_mensal
  314.      * Sample of usage: $comp_fam->renda_mensal = $object;
  315.      * @param $object Instance of RendaMensal
  316.      */
  317.     public function set_renda_mensal(RendaMensal $object)
  318.     {
  319.         $this->renda_mensal $object;
  320.         $this->renda_mensal_id $object->id;
  321.     }
  322.     
  323.     /**
  324.      * Method get_renda_mensal
  325.      * Sample of usage: $comp_fam->renda_mensal->attribute;
  326.      * @returns RendaMensal instance
  327.      */
  328.     public function get_renda_mensal()
  329.     {
  330.         // loads the associated object
  331.         if (empty($this->renda_mensal))
  332.             $this->renda_mensal = new RendaMensal($this->renda_mensal_id);
  333.     
  334.         // returns the associated object
  335.         return $this->renda_mensal;
  336.     }
  337.     
  338.     /**
  339.      * Reset aggregates
  340.      */
  341.     public function clearParts()
  342.     {
  343.         $this->titulars = array();
  344.     }
  345.     /**
  346.      * Load the object and its aggregates
  347.      * @param 2579 object ID
  348.      */
  349.     public function load(2579)
  350.     {
  351.     
  352.         // load the related Titular objects
  353.         $repository = new TRepository('Titular');
  354.         $criteria = new TCriteria;
  355.         $criteria->add(new TFilter('comp_fam_id''='2579));
  356.         $this->titulars $repository->load($criteria);
  357.     
  358.         // load the object itself
  359.         return parent::load(2579);
  360.     }
  361.     /**
  362.      * Store the object and its aggregates
  363.      */
  364.     public function store()
  365.     {
  366.         // store the object itself
  367.         parent::store();
  368.     
  369.         // delete the related Titular objects
  370.         $criteria = new TCriteria;
  371.         $criteria->add(new TFilter('comp_fam_id''='$this->id));
  372.         $repository = new TRepository('Titular');
  373.         $repository->delete($criteria);
  374.         // store the related Titular objects
  375.         if ($this->titulars)
  376.         {
  377.             foreach ($this->titulars as $titular)
  378.             {
  379.                 unset($titular->id);
  380.                 $titular->comp_fam_id $this->id;
  381.                 $titular->store();
  382.             }
  383.         }
  384.     }
  385.     /**
  386.      * Delete the object and its aggregates
  387.      * @param 2579 object ID
  388.      */
  389.     public function delete(2579 NULL)
  390.     {
  391.         2579 = isset(2579) ? 2579 $this->id;
  392.         // delete the related Titular objects
  393.         $repository = new TRepository('Titular');
  394.         $criteria = new TCriteria;
  395.         $criteria->add(new TFilter('comp_fam_id''='2579));
  396.         $repository->delete($criteria);
  397.         
  398.     
  399.         // delete the object itself
  400.         parent::delete(2579);
  401.     }
  402. }
  403. Cadastro:
  1. <?php
  2. /**
  3.  * CompFamForm Form
  4.  * @author  <your name here>
  5.  */
  6. class CompFamForm extends TPage
  7. {
  8.     protected $form// form
  9.     
  10.     /**
  11.      * Form constructor
  12.      * @param $param Request
  13.      */
  14.     public function __construct$param )
  15.     {
  16.         parent::__construct();
  17.         
  18.         // creates the form
  19.         $this->form = new TQuickForm('form_CompFam');
  20.         $this->form->class 'tform'// change CSS class
  21.         
  22.         $this->form->style 'display: table;width:100%'// change style
  23.         
  24.         // define the form title
  25.         $this->form->setFormTitle('CompFam');
  26.         
  27.         // create the form fields
  28.         2579 = new TEntry('id');
  29.         $compf_nome = new TEntry('compf_nome');
  30.         $compf_Idade = new TEntry('compf_Idade');
  31.         $compf_renda = new TEntry('compf_renda');
  32.         $compf_valbenef = new TEntry('compf_valbenef');
  33.         $compf_localtrabalho = new TEntry('compf_localtrabalho');
  34.         $compf_titular_id = new TEntry('compf_titular_id');
  35.         $compf_renda_comp_id = new TEntry('compf_renda_comp_id');
  36.         $compf_situacaotrab_id = new TEntry('compf_situacaotrab_id');
  37.         $compf_escolaridade_id = new TEntry('compf_escolaridade_id');
  38.         $compf_ocupacaoprof_id = new TEntry('compf_ocupacaoprof_id');
  39.         $compf_tipo_nec_esp_id = new TEntry('compf_tipo_nec_esp_id');
  40.         $compf_tempo_trabalho_id = new TEntry('compf_tempo_trabalho_id');
  41.         $compf_renda_mensal_id = new TEntry('compf_renda_mensal_id');
  42.         $compf_grauparent_id = new TEntry('compf_grauparent_id');
  43.         $compf_estado_civil_id = new TEntry('compf_estado_civil_id');
  44.         $compf_sitconjugal_id = new TEntry('compf_sitconjugal_id');
  45.         $compf_qualnecespecial = new TEntry('compf_qualnecespecial');
  46.         // add the fields
  47.         $this->form->addQuickField('Id'2579,  100 );
  48.         $this->form->addQuickField('Compf Nome'$compf_nome,  200 );
  49.         $this->form->addQuickField('Compf Idade'$compf_Idade,  100 );
  50.         $this->form->addQuickField('Compf Renda'$compf_renda,  100 );
  51.         $this->form->addQuickField('Compf Valbenef'$compf_valbenef,  100 );
  52.         $this->form->addQuickField('Compf Localtrabalho'$compf_localtrabalho,  200 );
  53.         $this->form->addQuickField('Compf Titular Id'$compf_titular_id,  100 );
  54.         $this->form->addQuickField('Compf Renda Comp Id'$compf_renda_comp_id,  100 );
  55.         $this->form->addQuickField('Compf Situacaotrab Id'$compf_situacaotrab_id,  100 );
  56.         $this->form->addQuickField('Compf Escolaridade Id'$compf_escolaridade_id,  100 );
  57.         $this->form->addQuickField('Compf Ocupacaoprof Id'$compf_ocupacaoprof_id,  100 );
  58.         $this->form->addQuickField('Compf Tipo Nec Esp Id'$compf_tipo_nec_esp_id,  100 );
  59.         $this->form->addQuickField('Compf Tempo Trabalho Id'$compf_tempo_trabalho_id,  100 );
  60.         $this->form->addQuickField('Compf Renda Mensal Id'$compf_renda_mensal_id,  100 );
  61.         $this->form->addQuickField('Compf Grauparent Id'$compf_grauparent_id,  100 );
  62.         $this->form->addQuickField('Compf Estado Civil Id'$compf_estado_civil_id,  100 );
  63.         $this->form->addQuickField('Compf Sitconjugal Id'$compf_sitconjugal_id,  100 );
  64.         $this->form->addQuickField('Compf Qualnecespecial'$compf_qualnecespecial,  200 );
  65.         if (!empty(2579))
  66.         {
  67.             2579->setEditable(FALSE);
  68.         }
  69.         
  70.         /** samples
  71.          $this->form->addQuickFields('Date', array($date1, new TLabel('to'), $date2)); // side by side fields
  72.          $fieldX->addValidation( 'Field X', new TRequiredValidator ); // add validation
  73.          $fieldX->setSize( 100, 40 ); // set size
  74.          **/
  75.          
  76.         // create the form actions
  77.         $this->form->addQuickAction(_t('Save'), new TAction(array($this'onSave')), 'fa:floppy-o');
  78.         $this->form->addQuickAction(_t('New'),  new TAction(array($this'onClear')), 'bs:plus-sign green');
  79.         
  80.         // vertical box container
  81.         $container = new TVBox;
  82.         $container->style 'width: 90%';
  83.         // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
  84.         $container->add($this->form);
  85.         
  86.         parent::add($container);
  87.     }
  88.     /**
  89.      * Save form data
  90.      * @param $param Request
  91.      */
  92.     public function onSave$param )
  93.     {
  94.         try
  95.         {
  96.             TTransaction::open('permission'); // open a transaction
  97.             
  98.             /**
  99.             // Enable Debug logger for SQL operations inside the transaction
  100.             TTransaction::setLogger(new TLoggerSTD); // standard output
  101.             TTransaction::setLogger(new TLoggerTXT('log.txt')); // file
  102.             **/
  103.             
  104.             $this->form->validate(); // validate form data
  105.             
  106.             $object = new CompFam;  // create an empty object
  107.             $data $this->form->getData(); // get form data as array
  108.             $object->fromArray( (array) $data); // load the object with data
  109.             $object->store(); // save the object
  110.             
  111.             // get the generated id
  112.             $data->id $object->id;
  113.             
  114.             $this->form->setData($data); // fill form data
  115.             TTransaction::close(); // close the transaction
  116.             
  117.             new TMessage('info'TAdiantiCoreTranslator::translate('Record saved'));
  118.         }
  119.         catch (Exception $e// in case of exception
  120.         {
  121.             new TMessage('error'$e->getMessage()); // shows the exception error message
  122.             $this->form->setData$this->form->getData() ); // keep form data
  123.             TTransaction::rollback(); // undo all pending operations
  124.         }
  125.     }
  126.     
  127.     /**
  128.      * Clear form data
  129.      * @param $param Request
  130.      */
  131.     public function onClear$param )
  132.     {
  133.         $this->form->clear();
  134.     }
  135.     
  136.     /**
  137.      * Load object to form data
  138.      * @param $param Request
  139.      */
  140.     public function onEdit$param )
  141.     {
  142.         try
  143.         {
  144.             if (isset($param['key']))
  145.             {
  146.                 $key $param['key'];  // get the parameter $key
  147.                 TTransaction::open('permission'); // open a transaction
  148.                 $object = new CompFam($key); // instantiates the Active Record
  149.                 $this->form->setData($object); // fill the form
  150.                 TTransaction::close(); // close the transaction
  151.             }
  152.             else
  153.             {
  154.                 $this->form->clear();
  155.             }
  156.         }
  157.         catch (Exception $e// in case of exception
  158.         {
  159.             new TMessage('error'$e->getMessage()); // shows the exception error message
  160.             TTransaction::rollback(); // undo all pending operations
  161.         }
  162.     }
  163. }
  164. Tabela Mysql
  165. CREATE TABLE `comp_fam` (
  166.   `idbigint(20unsigned NOT NULL AUTO_INCREMENT,
  167.   `compf_nomevarchar(100) DEFAULT NULL,
  168.   `compf_Idadeint(11) DEFAULT NULL,
  169.   `compf_rendafloat DEFAULT NULL,
  170.   `compf_valbeneffloat DEFAULT NULL,
  171.   `compf_localtrabalhovarchar(100) DEFAULT NULL,
  172.   `compf_titular_idbigint(20unsigned NOT NULL,
  173.   `compf_renda_comp_idbigint(20unsigned NOT NULL,
  174.   `compf_situacaotrab_idint(11NOT NULL,
  175.   `compf_escolaridade_idbigint(20unsigned NOT NULL,
  176.   `compf_ocupacaoprof_idbigint(20unsigned NOT NULL,
  177.   `compf_tipo_nec_esp_idbigint(20unsigned NOT NULL,
  178.   `compf_tempo_trabalho_idbigint(20unsigned NOT NULL,
  179.   `compf_renda_mensal_idbigint(20unsigned NOT NULL,
  180.   `compf_grauparent_idbigint(20unsigned NOT NULL,
  181.   `compf_estado_civil_idbigint(20unsigned NOT NULL,
  182.   `compf_sitconjugal_idint(11NOT NULL,
  183.   `compf_qualnecespecialvarchar(100) DEFAULT NULL,
  184.   PRIMARY KEY (`id`),
  185.   UNIQUE KEY `id` (`id`),
  186.   KEY `fk_comp_fam_titular_idx` (`compf_titular_id`),
  187.   KEY `fk_comp_fam_situacao_trab1_idx` (`compf_situacaotrab_id`),
  188.   KEY `fk_comp_fam_escolaridade1_idx` (`compf_escolaridade_id`),
  189.   KEY `fk_comp_fam_ocupacaoprof1_idx` (`compf_ocupacaoprof_id`),
  190.   KEY `fk_comp_fam_tipo_nec_esp1_idx` (`compf_tipo_nec_esp_id`),
  191.   KEY `fk_comp_fam_tempo_trabalho1_idx` (`compf_tempo_trabalho_id`),
  192.   KEY `fk_comp_fam_renda_mensal1_idx` (`compf_renda_mensal_id`),
  193.   KEY `fk_comp_fam_grauparent1_idx` (`compf_grauparent_id`),
  194.   KEY `fk_comp_fam_estado_civil1_idx` (`compf_estado_civil_id`),
  195.   KEY `sitconjugal_id` (`compf_sitconjugal_id`),
  196.   KEY `renda_comp_id` (`compf_renda_comp_id`),
  197.   CONSTRAINT `comp_fam_fkFOREIGN KEY (`compf_sitconjugal_id`) REFERENCES `sitconjugal` (`id`),
  198.   CONSTRAINT `fk_comp_fam_escolaridade1FOREIGN KEY (`compf_escolaridade_id`) REFERENCES `escolaridade` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  199.   CONSTRAINT `fk_comp_fam_estado_civil1FOREIGN KEY (`compf_estado_civil_id`) REFERENCES `estado_civil` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  200.   CONSTRAINT `fk_comp_fam_grauparent1FOREIGN KEY (`compf_grauparent_id`) REFERENCES `grauparent` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  201.   CONSTRAINT `fk_comp_fam_ocupacaoprof1FOREIGN KEY (`compf_ocupacaoprof_id`) REFERENCES `ocupacaoprof` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  202.   CONSTRAINT `fk_comp_fam_renda_comp1FOREIGN KEY (`compf_renda_comp_id`) REFERENCES `renda_compl` (`id`),
  203.   CONSTRAINT `fk_comp_fam_renda_mensal1FOREIGN KEY (`compf_renda_mensal_id`) REFERENCES `renda_mensal` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  204.   CONSTRAINT `fk_comp_fam_sittrabalhista1FOREIGN KEY (`compf_situacaotrab_id`) REFERENCES `situacao_trab` (`id`),
  205.   CONSTRAINT `fk_comp_fam_tempo_trabalho1FOREIGN KEY (`compf_tempo_trabalho_id`) REFERENCES `tempo_trabalho` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  206.   CONSTRAINT `fk_comp_fam_tipo_nec_esp1FOREIGN KEY (`compf_tipo_nec_esp_id`) REFERENCES `tipo_nec_esp` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  207.   CONSTRAINT `fk_comp_fam_titularFOREIGN KEY (`compf_titular_id`) REFERENCES `titular` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
  208. ENGINE=InnoDB DEFAULT CHARSET=utf8;
  209. A tela de erro segue em anexo

Curso completo Meu Negócio Pronto
Use para si, ou transforme em um negócio: Inclui aulas e códigos-fontes
Gestor de conteúdo (SITE) + Loja Virtual (E-Commerce) + Emissor de Notas para infoprodutos


Meu negócio pronto Quero me inscrever agora!

Comentários (1)


NR

Pelo que percebi, ao criar o model pelo Studio você criou um relacionamento com a tabela Titular. Por isso, sempre que você carrega um objeto do tipo CompFam, automicamente o model busca na tabela titular os itens relacionados. Veja o método load do model CompFam:
  1. <?php
  2. public function load($id)
  3.     {
  4.     
  5.         // load the related Titular objects
  6.         $repository = new TRepository('Titular');
  7.         $criteria = new TCriteria;
  8.         $criteria->add(new TFilter('comp_fam_id''='$id));
  9.         $this->titulars $repository->load($criteria);
  10.     
  11.         // load the object itself
  12.         return parent::load($id);
  13.     } 
  14. ?>

Se este relacionamento está correto, então sugiro que confira o nome da coluna 'comp_fam_id' do model Titular, pois é essa coluna que está sendo utilizada para realizar o filtro.