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

Does not work with relations defined in the metadata of the Active Record #36

Open
cebe opened this issue Mar 30, 2013 · 0 comments
Open
Assignees

Comments

@cebe
Copy link
Member

cebe commented Mar 30, 2013

Taken from this comment:
http://www.yiiframework.com/extension/activerecord-relation-behavior/#c12592

Before I start, let me express that I am grateful this extension was done in the first place. It is something needed and I hope it is added to the core as it will accelerate the development proccess. That being said..

I have a behavior that is called categorizable. Basically I add the behavior to any model that I want to be able to receive categories. In the behavior, I add the relationship with categories through the metaData of the Active Record.

This extension takes the relations from the Active Record from the relations() method which is an array containing a configuration. However, this configuration does not refresh when the metadata of relations is updated.

Therefore this plugin does not work if you add a relationship via the metadata of the active record.

There are two possible solutions for this.

  • Modify (Directly or Extending) the EActiveRecordRelationBehavior so that it reads the relations from the metadata and not from the relations() method.
  • Modify the relations method so that it is updated when the metadata is updated....however this solution gives me the sense that will break other things :$ so I am going for the first one.
@ghost ghost assigned cebe Mar 30, 2013
omnilight added a commit to omnilight/activerecord-relation-behavior that referenced this issue Aug 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant