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 6147517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:07:05+00:00 2026-05-23T19:07:05+00:00

I have an events table and events images table. I am having a form

  • 0

I have an events table and events images table. I am having a form to add new event so i am also adding multiple images for that event. So that i am storing in event images table.

so how do i insert the data in both the tables..

<?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;


    /**
     * @OneToMany(targetEntity="Default_Model_EventImages" mappedBy="eventimage_mapper") 
     */
    private $images_mapper;


}//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;

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



}//end class

From my controller how do i save the data now.. I am thinking of first saving the event data and than will get that id and than will save the events images by loop.. than i am not getting what will be the use of the one to many mapper i have created..

I am using zend framework 1.11 and Doctrine 2.0

  • 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-23T19:07:05+00:00Added an answer on May 23, 2026 at 7:07 pm

    At first you need to create getters, setters to your objects. Then you just create

    $event = new Default_Model_Event();
    $em->persist($event);
    
    while (something) {
      $image = new Default_Model_EventImages();
      $image->setEventimage_mapper($event);
      $em->persist($image);
    }
    
    $em->flush();
    

    Just read the Doctrine documentation on associations. It will help for sure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table of events. Each event has a category and a
I have a table of data which represents a series of events that persons
I have a MySQL table containing a listing of events that I am trying
I have 2 tables. In one table I add events, ID are auto-increment. The
I have a row in an html-table that contains only images. (this happens to
I have an events table with a 'featureEvent' boolean column. I need to display
I have an Events table with a not-null date field. Based on a pivot
I have 2 tables events and events_visibility events table and the column id -
Suppose I have a table events {id, userid, create_time, country, type, page, browser} I
I have one table which contains events and dates, and another which contains the

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.