Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of $this->items #6

Open
carl-mo opened this issue Nov 11, 2014 · 2 comments
Open

Usage of $this->items #6

carl-mo opened this issue Nov 11, 2014 · 2 comments

Comments

@carl-mo
Copy link

carl-mo commented Nov 11, 2014

Hi Federico,

The n-n relation saving works perfect and many thanks on that. A new question on displaying on read view, as you mentioned in the README.md the $this->items data holds the object of current view and it's related objects (eg. $this->items in team view contains team object and it's related player object, as their n-n relation is specify in #__foobar_teams_players table). However, when I try to var_dump or log $this->items in both back-end edit and front-end read view, it returns Undefined property: F0FViewForm::$items. For the case $this->item without 's', I got the object for the current view but not the related objects.

Sorry to bother you again, appreciate your effort very much!

BR,
Carl

@carl-mo carl-mo changed the title Usgae of $this->items Usage of $this->items Nov 11, 2014
@f-liva
Copy link
Owner

f-liva commented Nov 12, 2014

You have $this->items in a browse view and $this->item in a read or edit view.

@carl-mo
Copy link
Author

carl-mo commented Nov 12, 2014

See. When I try var_dump the $this->items in a browse view, I cannot see the related object, like your players object in your example

stdClass Object
(
  [title] => Foobar Team
  [players] => stdClass Object
    (
      [0] => Array
        (
          [title] => John
          [...] => ...
        )
      [2] => ...
    )
)

Am I missing out something? Part of my fof.xml are as below:

<fof>
    <common>
        <table name="nanny">
            <relation name="districts" type="multiple" pivotTable="#__nannysearch_nannies_districts" />
            <behaviors>nnrelation</behaviors>
        </table>
        <view name="nannies">
            <config>
                <option name="behaviors">nnrelation</option>
            </config>
        </view>
    </common>

In my case I cannot see the districts object under the nanny object.
And one more question, would this related object magic apply to read/edit view?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants