Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6124913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:11:15+00:00 2026-05-23T16:11:15+00:00

I am getting following error in doctrine… A new entity was found through a

  • 0

I am getting following error in doctrine…

A new entity was found through a relationship that was not configured to cascade persist operations: Default_Model_EventImages@000000004b59e58d000000003ff05ded. Explicitly persist the new entity or configure cascading persist operations on the relationship.

Event model

<?php
/**
 * @Entity
 * @Table(name="events")
 */
class Default_Model_Event
{
     /**
     * @Id @Column(name="id", type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    private $id;


    /** 
    * @Column(name="title", type="string") 
    */
    private $title;

    /** 
    * @Column(name="date_from", type="string") 
    */
    private $date_from;

    /** 
    * @Column(name="date_to", type="string") 
    */
    private $date_to;

    /** 
    * @Column(name="venue", type="string") 
    */
    private $venue;

    /** 
    * @Column(name="address", type="string") 
    */
    private $address;

    /** 
    * @Column(name="city", type="string") 
    */
    private $city;

    /** 
    * @Column(name="state", type="string") 
    */
    private $state;

    /** 
    * @Column(name="zip", type="string") 
    */
    private $zip;

    /** 
    * @Column(name="country", type="string") 
    */
    private $country;

    /** 
    * @Column(name="company_logo", type="string") 
    */
    private $company_logo;

    /** 
    * @Column(name="website", type="string") 
    */
    private $website;

    /** 
    * @Column(name="email", type="string") 
    */
    private $email;

    /** 
    * @Column(name="phone_number", type="string") 
    */
    private $phone_number;  

    /**
    * @Column(name="short_description", type="text") 
    */
    private $short_description;

     /**
    * @Column(name="long_description", type="text") 
    */
    private $long_description;

    /** 
    * @Column(name="status", type="string") 
    */
    private $status;

    /** 
    * @Column(name="date_created", type="string") 
    */
    private $date_created;

    /** 
    * @Column(name="date_modified", type="string") 
    */
    private $date_modified;

    /**
     * @ManyToOne(targetEntity="Default_Model_User", inversedBy="user_mapper")
     * @JoinColumn(name="user_id", referencedColumnName="id")
     */
    private $event_mapper;

    /**
     * @OneToMany(targetEntity="Default_Model_EventImages", mappedBy="eventimage_mapper",cascade={"All"}) 
     */
    private $images_mapper;


    public function setUser($event_mapper)
    {
      if (!is_null($event_mapper )) {
         $event_mapper->assignedToEvent($this);
         $this->event_mapper = $event_mapper;
      }
    }

    public function setEventimage_mapper($name, $order) {
        $this->images_mapper[$name] = new Default_Model_EventImages($name, $order, $this);
    }

    /**
     * @return the $id
     */
    public function getId() {
        return $this->id;
    }


    /**
     * @return the $title
     */
    public function getTitle() {
        return $this->title;
    }

    /**
     * @return the $date_from
     */
    public function getDate_from() {
        return $this->date_from;
    }

    /**
     * @return the $date_to
     */
    public function getDate_to() {
        return $this->date_to;
    }

    /**
     * @return the $venue
     */
    public function getVenue() {
        return $this->venue;
    }

    /**
     * @return the $address
     */
    public function getAddress() {
        return $this->address;
    }

    /**
     * @return the $city
     */
    public function getCity() {
        return $this->city;
    }

    /**
     * @return the $state
     */
    public function getState() {
        return $this->state;
    }

    /**
     * @return the $zip
     */
    public function getZip() {
        return $this->zip;
    }

    /**
     * @return the $country
     */
    public function getCountry() {
        return $this->country;
    }

    /**
     * @return the $company_logo
     */
    public function getCompany_logo() {
        return $this->company_logo;
    }

    /**
     * @return the $website
     */
    public function getWebsite() {
        return $this->website;
    }

    /**
     * @return the $email
     */
    public function getEmail() {
        return $this->email;
    }

    /**
     * @return the $phone_number
     */
    public function getPhone_number() {
        return $this->phone_number;
    }

    /**
     * @return the $short_description
     */
    public function getShort_description() {
        return $this->short_description;
    }

    /**
     * @return the $long_description
     */
    public function getLong_description() {
        return $this->long_description;
    }

    /**
     * @return the $status
     */
    public function getStatus() {
        return $this->status;
    }

    /**
     * @return the $date_created
     */
    public function getDate_created() {
        return $this->date_created;
    }

    /**
     * @return the $date_modified
     */
    public function getDate_modified() {
        return $this->date_modified;
    }

    /**
     * @param field_type $id
     */
    public function setId($id) {
        $this->id = $id;
    }

    /**
     * @param field_type $title
     */
    public function setTitle($title) {
        $this->title = $title;
    }


    /**
     * @param field_type $date_from
     */
    public function setDate_from($date_from) {
        $this->date_from = $date_from;
    }

    /**
     * @param field_type $date_to
     */
    public function setDate_to($date_to) {
        $this->date_to = $date_to;
    }

    /**
     * @param field_type $venue
     */
    public function setVenue($venue) {
        $this->venue = $venue;
    }

    /**
     * @param field_type $address
     */
    public function setAddress($address) {
        $this->address = $address;
    }

    /**
     * @param field_type $city
     */
    public function setCity($city) {
        $this->city = $city;
    }

    /**
     * @param field_type $state
     */
    public function setState($state) {
        $this->state = $state;
    }

    /**
     * @param field_type $zip
     */
    public function setZip($zip) {
        $this->zip = $zip;
    }

    /**
     * @param field_type $country
     */
    public function setCountry($country) {
        $this->country = $country;
    }

    /**
     * @param field_type $company_logo
     */
    public function setCompany_logo($company_logo) {
        $this->company_logo = $company_logo;
    }

    /**
     * @param field_type $website
     */
    public function setWebsite($website) {
        $this->website = $website;
    }

    /**
     * @param field_type $email
     */
    public function setEmail($email) {
        $this->email = $email;
    }

    /**
     * @param field_type $phone_number
     */
    public function setPhone_number($phone_number) {
        $this->phone_number = $phone_number;
    }

    /**
     * @param field_type $short_description
     */
    public function setShort_description($short_description) {
        $this->short_description = $short_description;
    }

    /**
     * @param field_type $long_description
     */
    public function setLong_description($long_description) {
        $this->long_description = $long_description;
    }

    /**
     * @param field_type $status
     */
    public function setStatus($status) {
        $this->status = $status;
    }

    /**
     * @param field_type $date_created
     */
    public function setDate_created($date_created) {
        $this->date_created = $date_created;
    }

    /**
     * @param field_type $date_modified
     */
    public function setDate_modified($date_modified) {
        $this->date_modified = $date_modified;
    }


}//end class

Event images model

<?php
/**
 * @Entity
 * @Table(name="event_images")
 */
class Default_Model_EventImages
{
     /**
     * @Id @Column(name="id", type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    private $id;

    /** 
    * @Column(name="name", type="string") 
    */
    private $name;

    /** 
    * @Column(name="order", type="integer") 
    */
    private $order;

    /** 
    * @Column(name="status", type="string") 
    */
    private $status;

    /** 
    * @Column(name="date_created", type="string") 
    */
    private $date_created;

    /** 
    * @Column(name="date_modified", type="string") 
    */
    private $date_modified;

    /**
     * @ManyToOne(targetEntity="Default_Model_Event", inversedBy="images_mapper", cascade={"All"})
     * @JoinColumn(name="event_id", referencedColumnName="id")
     */
    private $eventimage_mapper;


    public function __construct($name, $order, $event) {
        $this->name = $name;
        $this->order = $order;
        $this->eventimage_mapper = $event;
        $this->date_created = new DateTime();
        $this->status = 'active';
    }

    /**
     * @return the $id
     */
    public function getId() {
        return $this->id;
    }

    /**
     * @return the $status
     */
    public function getStatus() {
        return $this->status;
    }

    /**
     * @return the $date_created
     */
    public function getDate_created() {
        return $this->date_created;
    }

    /**
     * @return the $date_modified
     */
    public function getDate_modified() {
        return $this->date_modified;
    }

    /**
     * @param field_type $id
     */
    public function setId($id) {
        $this->id = $id;
    }

    /**
     * @param field_type $status
     */
    public function setStatus($status) {
        $this->status = $status;
    }

    /**
     * @param field_type $date_created
     */
    public function setDate_created($date_created) {
        $this->date_created = $date_created;
    }

    /**
     * @param field_type $date_modified
     */
    public function setDate_modified($date_modified) {
        $this->date_modified = $date_modified;
    }


}//end class

controller

$user_id = '2'; //(int)$formData['category_id'];
                $user_mapper = $this->_em->find("Default_Model_User", (int)$user_id);
                $event = new Default_Model_Event(); 
                $event->setUser($user_mapper);

                $event->setTitle($title);
                $event->setDate_from($date_from);
                $event->setDate_to($date_to);
                $event->setVenue($venue);
                $event->setAddress($address);
                $event->setCity($city);
                $event->setState($state);
                $event->setZip($zip);
                $event->setCountry($country);
                $event->setCompany_logo($company_logo);
                $event->setWebsite($website);
                $event->setEmail($email);
                $event->setPhone_number($phone);
                $event->setStatus('pending');
                $event->setShort_description($short_description);
                $event->setLong_description($long_description);
                $date = new Zend_Date;
                $event->setDate_created($date->toString('YYYY-MM-dd HH:mm:ss'));

                foreach($images as $key => $value) {
                    $event->setEventimage_mapper($value, $key);
                    //$this->_em->persist($eventImages);
                }

                $this->_em->persist($event);
                $this->_em->flush();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:11:16+00:00Added an answer on May 23, 2026 at 4:11 pm

    Actually the problem was i had to persist all the event images object individually..

    foreach($images as $key => $value) {
        $eventImages = $event->setEventimage_mapper($value, $key);
        $this->_em->persist($eventImages);
    

    }

    and in event model

    public function setEventimage_mapper($name, $order) {
            return $this->images_mapper[$name] = new Default_Model_EventImages($name, $order, $this);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting following error message when using Doctrine ORM in Codeigniter. ( !
Im getting following error while running the query. org.hibernate.hql.ast.QuerySyntaxException: expecting CLOSE, found 'LIMIT' near
I am getting following error: COM object that has been separated from its underlying
I'm having a little issue with Doctrine. Im getting the following error: PHP Fatal
I am getting following error in production but the same is not a repro
We are getting following error when we enter an email address which is not
Hey just getting following error Could not load file or assembly 'Ektron.Cms.Controls, Version=8.0.1.87, Culture=neutral,
Am getting following error message on calling WCF service: The formatter threw an exception
I am getting following error when I am trying to get WebResponse using WebResponse
SOLVED in the last answer im getting following error, dunno where and why? cause

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.