Codeigniter - Doctrine Input Error - Many To One Attitude

I had a problem inserting a new row into a database using Doctrine 2 and Codeigniter 2.

I have two tables: languages, categories.

TABLE: CATEGORIES:

id, languages_id, parent_id, title

Detailed table structure - http://pastebin.com/NhULaasc

TABLE: LANGUAGES:

id, title, slug, icon

Detailed table structure - http://pastebin.com/Y6WpzdqF

ENTITIES:

Categories.php - http://pastebin.com/HbpKZGBL

Languages.php - http://pastebin.com/vDEd60NP

modelsLanguagesProxy.php - http://pastebin.com/j6zkeR3J

INSERT PROCEDURE:

$data = $this->input->post(); if( is_array($data) && count($data) ) { unset($data['submit']); $add = new models\Categories(); $add->setLanguage($data['language_id']); $add->setParentId($data['parent']); $add->setTitle($data['title']); $this->em->persist($add); $this->em->flush(); if( $add->getId() ) { $this->session->set_flashdata('message','Kategorija je dodana!'); redirect('admin/kategorije'); }else{ $this->session->set_flashdata('message','Kategorija ni dodana!'); redirect('admin/kategorije'); } } 

ERROR:

 Fatal error: Uncaught exception 'InvalidArgumentException' with message 'A new entity was found through the relationship 'models \Categories#languages' that was not configured to cascade persist operations for entity: @. Explicitly persist the new entity or configure cascading persist operations on the relationship.... 

What am I doing wrong?

0
source share
1 answer

I solved the problem.

My complete solution: https://gist.github.com/1338884

0
source

All Articles