Ticket #493 (closed Feature Request: fixed)

Opened 6 months ago

Last modified 7 weeks ago

ORM Does Not Allow For Multiple DB'S

Reported by: glock_coma Owned by: Shadowhand
Priority: major Milestone: 2.2
Component: Libraries:ORM Version: SVN HEAD
Keywords: Cc:

Description

Currently, Kohana's ORM does not allow for the use of other db's besides the default db.

[20:29] <NS|Glock_Coma> how do you set the db which a ORM Model uses? [20:35] <allain> It gets it's db from Kohana::$instance->db [20:35] <NS|Glock_Coma> what if i need to use a different db? [20:36] <allain> Since it's a static field [20:36] <allain> ... [20:36] <allain> I think you're out of luck. [20:36] <allain> All of them use the same one. [20:36] <allain> All ORM objects have to use the same DB [20:36] <allain> Submit a ticket. I think it's worth it. [20:37] <PugFish?> you can override connect() in your model and create your own db connection [20:37] <allain> Bug isn't self::$db used for all of the instances [20:38] <PugFish?> yea [20:39] <allain> So you'd be doing it for all instance of the subclass in one shot. [20:39] <PugFish?> well i'd assume you'd want to, but yea that's a limitation

Change History

Changed 6 months ago by PugFish

I realised after saying that that it won't work, self::$db in ORM will refer to ORM::$db and won't read the db connection created in the subclass.

Changed 3 months ago by Shadowhand

  • milestone changed from 2.1.2 to 2.2

Changed 7 weeks ago by Shadowhand

  • status changed from new to assigned

Fixed in r3021.

Changed 7 weeks ago by Shadowhand

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.