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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:41:34+00:00 2026-06-02T12:41:34+00:00

I’d like to have an array of arrays in a class using Zend and

  • 0

I’d like to have an array of arrays in a class using Zend and Doctrine2.

So I have a class named Grid, which should have an attribute containing an array of arrays of GridItem. These GridItem‘s also containing a link to an instance of Product.

Here’s Grid.php:

/**
* @Entity
* @Table(name="Grid")
*/
class GPos_Model_Grid extends GPos_Doctrine_ActiveEntity {
    /**
    * @Id @Column(type="integer")
    * @GeneratedValue
    */
    private $id;

    /** @Column(type="integer") */
    private $number;

    //THIS IS THE ATTRIBUTE
    private $grid;
}

And here’s GridItem.php:

/**
* @Entity
* @Table(name="GridItem")
*/
class GPos_Model_GridItem extends GPos_Doctrine_ActiveEntity {
    /**
     * @Id @Column(type="integer")
     * @GeneratedValue
     */
    private $id;

    /** @Column(length=7) */
    private $color;

    /** @Column(type="boolean") */
    private $grid;

    /**
     * @ManyToOne(targetEntity="Product")
     * @JoinColumn(name="product_id", referencedColumnName="id")
     */
    private $product;
}

So as I said, I’d like the $grid attribute to be stored as an ArrayCollection of ArrayCollections of GridItem.
However, I can’t figure out what annotation I should use to make this happen. The only way I found right now is to create a middle class between Grid and GridItem that would be something like GridRow. So I could have Many-To-One associations between all of them. But this produces a new ‘joint’ between tables and I’d have a small but still significant performance hit which I can’t afford.

Do you guys have any advice on how to do this without that GridRow class ? Thus using only Grid and GridItem ?

Thank you for helping me!

  • 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-06-02T12:41:35+00:00Added an answer on June 2, 2026 at 12:41 pm

    I finally opted for the GridRow option as I found no way of storing arrays of arrays..

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to
I have some data like this: 1 2 3 4 5 9 2 6
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.