Yii Framework Forum: Beyond Activerecord - Where Do I Go? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Beyond Activerecord - Where Do I Go? Rate Topic: -----

#1 User is offline   SebK 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 40
  • Joined: 19-April 12

Posted 24 April 2013 - 06:15 AM

I'm trying to build an application that goes beyond having relationships that are easily mapped 1:1 between Model and Database. I've had a look around the forums and the internet in general and there seems to be a big debate about "The Vietname of Computing Science" and Mappers etc. but I haven't found the golden bullet, that I've admittedly been looking for.

Is there a best practice in Yii for how you organise your database interaction when "standard" AR fails you? I've read about behaviours, single table inheritance and overriding the instantiate method. I've not had that "aha" moment where I was looking at an obviously good solution to this issue. One option I have considered is using RedbeanPHP but that would be a pretty big step away from Yii.

Do I introduce a data mapper class to convert my PHP classes into entities I can store? What do I do?

If you could point me one direction or another I'll do my best to go there.

Thanks for your help.
0

#2 User is offline   leandro 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 01-February 10

Posted 24 April 2013 - 06:22 AM

Hi SebK,

I think that Yii ActiveRecord models are pretty powerful, and behaviors are a nice way to add common functionality to them without duplicate code (among other benefits).

What kind of features you need in your application?

Regards,
Leandro
0

#3 User is offline   SebK 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 40
  • Joined: 19-April 12

Posted 24 April 2013 - 08:12 AM

Hi leandro,

As soon as my model doesn't easily map to a single table, I get lost. For example when I have inheritance, i.e. a structure like this (I'm still trying to figure out exactly how I want to break the classes down but this would make sense to me to begin with)

http://abload.de/ima...04-24ac7jnc.png (can't seem to insert the png file, sorry I'm at work...)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users