[gallery/gallery3] 35daad: Oops - fix a hardcoded instance of "Item" instead ...

GitHub <noreply-9UaJU3cA/F/[email protected]> Thu, 02 May 2013 22:31:29 -0700
Newsgroups gmane.comp.web.gallery.cvs
Message-ID <51834bb157d47_442ea2fe1844492@hookshot-fe4-pe1-prd.aws.github.net.mail>
  Branch: refs/heads/kohana_3
  Home:   https://github.com/gallery/gallery3
  Commit: 35daad0d67782a9ae07313bbceb7ab0a56b59b0e
      https://github.com/gallery/gallery3/commit/35daad0d67782a9ae07313bbceb7ab0a56b59b0e
  Author: Bharat Mediratta <[email protected]>
  Date:   2013-05-02 (Thu, 02 May 2013)

  Changed paths:
    M modules/gallery/classes/Gallery/ORM/MPTT.php

  Log Message:
  -----------
  Oops - fix a hardcoded instance of "Item" instead of $this->_model_name.


  Commit: eb5d691abab94b31514a359de57118bff6800c26
      https://github.com/gallery/gallery3/commit/eb5d691abab94b31514a359de57118bff6800c26
  Author: Bharat Mediratta <[email protected]>
  Date:   2013-05-02 (Thu, 02 May 2013)

  Changed paths:
    M modules/gallery/classes/Gallery/Model/Item.php
    M modules/gallery/classes/Gallery/View/Theme.php

  Log Message:
  -----------
  Reverting the ORM::$_sorting change because it doesn't do quite what
we want when it comes to dealing with descendants.

Basically, if you do:

    $album = Test::random_album_unsaved();
    $album->sort_column = "view_count";
    $album->sort_order = "DESC";
    $album->save();
    $album->descendants->find_all();

(captured in Item_Model_Test::test_descendants_default_to_albums_sort_order)

what happens is that ORM_MPTT::get() returns a new instance of
Model_Item with the left and right pointer constrained:

      return ORM::factory($this->_model_name)
  ->where("left_ptr", ">", $this->left_ptr)
  ->where("right_ptr", "<", $this->right_ptr);

but this is a default instance that doesn't have any of the other
values from the original instance ($album in the example above) so it
doesn't the ORM::$_sorting member variable correctly, so
ORM::_loaded_result() won't pick it up.

I didn't see an obvious way to resolve this so I wrote a test and
rolled this back for now.  Feel free to roll it forward again with an
implementation that makes the test pass.  :-)

--

Revert "Ensure that the Model_Item default sorting is reset after save(), too."
This reverts commit 6a4233b5c9c9ae1565eaf597747cf01ba29bed92.

Revert "Use ORM::$_sorting to set default sorting, remove $item->unsorted_children."
This reverts commit ffee4501219e0887b9a4a5bd09c9ca6308a7a597.


Compare: https://github.com/gallery/gallery3/compare/17db8513a115...eb5d691abab9

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2

__[ g a l l e r y - c h e c k i n s ]_________________________

[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]