Jump to content


Photo

support LINK_TYPE_POLYMORPHIC In related list views

custom

  • Please log in to reply
2 replies to this topic

#1 windsor

windsor

    Advanced Member

  • Moderators
  • 242 posts

Posted 16 August 2013 - 01:08 PM

Use case:

 

1. You have a child  object  Y which can have more than one type of parent object (X, W. V)

2. you want to be able to see all related Y in a portal on XDetailsAndRelationsView

 

Currently appears to require manually coding a view , otherwise  breaks with "undfined index" when rendering view based on XsForWRelatedListView

 

When you declare a relation like this in X, W, or V:

 

$globalMetadata ...
  'relations' => array(
         'myYthngs' => array(RedBeanModel::HAS_MANY, 'Y', RedBeanModel::OWNED, LINK_TYPE_POLYMORPHIC, 'relatedModel'),
  ),
 ...

This will create two new columns in the Y table in the database:

relatedmodel_id

relatedmodel_type

 

But if you try to clone any ...RelatedListView , such as "OpportunitiesForAccountRelatedListView"  .. you won't be able to render the view,,, even if you override RelatedListView::getDataProvider().

 

This seems to be b/c the current implementation is looking for a relation column for X, in the Y table.  This won't exist. b/c we set the link type to poly in the relation.  Currently in Comments/Missions modules for example, I see that entire view is created from scratch, and where clause is set independently (possibly to avoid using) dataProvider mechanism.

 

There should be support in the core so that we can leverage the existing view rendering architecture to create related list views, for polymorphic relations. rather than have to re-write views from scratch.

 

Would like to learn more about how this mechanism works, and which files to override to be able to use the ...RelatedListView  views with poly type relations.

 

If we can set up a dev session for this topic to get some guidance,  I would be willing to contribute to coding the solution.  I think the session could be helpful to developers who need a better understanding of the RB models and views interact.



#2 Stafford

Stafford

    Zurmo Member

  • Moderators
  • 212 posts

Posted 20 August 2013 - 01:21 PM

Can you join us today at 10AM CST (15:00 UTC) for our weekly dev learning session? Our lead engineer can help you out live. http://zurmo.org/for...arning-session/



#3 raysto

raysto

    Zurmo Team

  • Administrators
  • 1,929 posts

Posted 20 August 2013 - 05:49 PM

Use case:

 

1. You have a child  object  Y which can have more than one type of parent object (X, W. V)

2. you want to be able to see all related Y in a portal on XDetailsAndRelationsView

 

Currently appears to require manually coding a view , otherwise  breaks with "undfined index" when rendering view based on XsForWRelatedListView

 

When you declare a relation like this in X, W, or V:

 

$globalMetadata ...
  'relations' => array(
         'myYthngs' => array(RedBeanModel::HAS_MANY, 'Y', RedBeanModel::OWNED, LINK_TYPE_POLYMORPHIC, 'relatedModel'),
  ),
 ...

This will create two new columns in the Y table in the database:

relatedmodel_id

relatedmodel_type

 

But if you try to clone any ...RelatedListView , such as "OpportunitiesForAccountRelatedListView"  .. you won't be able to render the view,,, even if you override RelatedListView::getDataProvider().

 

This seems to be b/c the current implementation is looking for a relation column for X, in the Y table.  This won't exist. b/c we set the link type to poly in the relation.  Currently in Comments/Missions modules for example, I see that entire view is created from scratch, and where clause is set independently (possibly to avoid using) dataProvider mechanism.

 

There should be support in the core so that we can leverage the existing view rendering architecture to create related list views, for polymorphic relations. rather than have to re-write views from scratch.

 

Would like to learn more about how this mechanism works, and which files to override to be able to use the ...RelatedListView  views with poly type relations.

 

If we can set up a dev session for this topic to get some guidance,  I would be willing to contribute to coding the solution.  I think the session could be helpful to developers who need a better understanding of the RB models and views interact.

We spoke about this during the Dev Session. Perhaps you can provide some more info so that we can spend some time on next week's dev session going over this.


Ray Stoeckicht
Zurmo Team
Try Zurmo Pro






Also tagged with one or more of these keywords: custom

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users