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

Curso Dominando o Adianti Framework

O material mais completo de treinamento do Framework.
Curso em vídeo aulas + Livro completo + Códigos fontes do projeto ERPHouse.
Conteúdo Atualizado!


Dominando o Adianti Framework 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. // load the related Titular objects
  5. $repository = new TRepository('Titular');
  6. $criteria = new TCriteria;
  7. $criteria->add(new TFilter('comp_fam_id', '=', $id));
  8. $this->titulars = $repository->load($criteria);
  9. // load the object itself
  10. return parent::load($id);
  11. }
  12. ?>

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.