Ticket #16 (reopened task)

Opened 6 years ago

Last modified 4 years ago

ActiveRecord->save_association() should use is_subclass_of(), not get_parent_class()

Reported by: Alderete Owned by: anonymous
Priority: lowest Milestone:
Component: Action View Version: 0.11.0
Severity: trivial Keywords:
Cc:

Description

In order to allow intermediate subclasses of ActiveRecord?, I propose that the save_association() method use is_subclass_of() instead of get_parent_class() to determine if the object is an ActiveRecord? and should be saved to the database.

Specifically, change line 1420 of active_record.php:

-  if(is_object($object) && get_parent_class($object) == __CLASS__ && $type) {		
+  if(is_object($object) && is_subclass_of($object, __CLASS__) && $type) {

Although normal usage of PHP on Trax does not require creating a subclass of ActiveRecord?, it is important for using ActiveRecord? in stand-alone mode. And it should make no difference to normal usage in Trax.

Change History

Changed 6 years ago by john

  • cc richarde@… removed
  • keywords Putyournoseoutofjoint removed
  • type changed from spam to task
  • summary changed from dorithise to ActiveRecord->save_association() should use is_subclass_of(), not get_parent_class()

Changed 6 years ago by john

  • summary changed from ActiveRecord->save_association() should use is_subclass_of(), not get_parent_class() to ActiveRecord->save_association() should use is_subclass_of(), not get_parent_class()
Note: See TracTickets for help on using tickets.