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

  • Home
  • SEARCH
  • 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 6214845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:56:54+00:00 2026-05-24T06:56:54+00:00

I have: @method Users setMail() Sets the current record’s mail value @method Users setUsersGroups()

  • 0

I have:

  @method Users    setMail()         Sets the current record's "mail" value
  @method Users    setUsersGroups()       Sets the current record's "UsersGroups" collection


   public function save(Doctrine_Connection $conn = null) {

    if($this->isNew()) {

        $this->setMail('test@test.com')); // ok
        $this->setUsersGroups(2);         // doesn't work - error Couldn't call Doctrine_Core::set(), second argument should be an instance of Doctrine_Collection when setting one-to-many references.
    }

    parent::save($conn);


}

Table UsersGroups:

  user_id
  group_id

this is many to many relations.

how can i set users for groups?

example schema:

Users:
  columns:
    id:
      type: integer(4)
      autoincrement: true
      primary: true
    mail:
      type: string(255)
    password:
      type: string(255)
  attributes:
    export: all
    validate: true

Group:
  tableName: group_table
  columns:
    id:
      type: integer(4)
      autoincrement: true
      primary: true
    name:
      type: string(255)
  relations:
    Users:
      foreignAlias: Groups
      class: User
      refClass: GroupUser

UsersGroups:
  columns:
    group_id:
      type: integer(4)
      primary: true
    user_id:
      type: integer(4)
      primary: true
  relations:
    Group:
      foreignAlias: UsersGroups
    Users:
      foreignAlias: UsersGroups
  • 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-24T06:56:54+00:00Added an answer on May 24, 2026 at 6:56 am
       public function save(Doctrine_Connection $conn = null) {
    
         if($this->isNew()) {
    
            $this->setMail('test@test.com')); // ok
            parent::save($conn);    
    
            $ug = new UsersGroups();
            $ug->setUserId($this->getId());
            $ug->setGroupId(2);
            $ug->save();
    
         } else {
           parent::save($conn);
         }
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ajax method that renderes a @collection of users. This code is
I have a method, that returns a group of accounts Public Shared Function GetAllNotesByUser(ByVal
I have this method: public function activation_code() { //activation code sent into db $activation_code
I currently have this method: public function getUser($id) { $user = $this->db->getSingleRecord(SELECT user_id, user_login,
I have a method and I want different users to pass me xml files.
I have an update method in my users controller that I call from a
i have a method where i am saving the data from users, but each
While I have a successful method of getting users from our mobile site to
I have this function, which is doing an asynchronous call to FB.api method. Now,
I have a method that generically deserializes a stored object from a users provided

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.