Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-20414

Public API - Creating new location for object, on the original location it doesn't show the new location

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: High High
    • Resolution: Invalid
    • Affects Version/s: 5.1-dev
    • Fix Version/s: QA tracked issues
    • Labels:
    • Environment:

      Server OS: Red Hat 6
      Database: MySQL 5.1.61
      Browser: Firefox 18.0.1

    • Sprint:
      Stetind Sprint 6

      Description

      When creating a new location for an object through the Public API, on the original location in the "Locations" details there is only the original location.
      However at the new location both locations are shown up

      Code:
      at ezpublishapilocations.php

          function _testTC625Locations__stage3()
          {
              $this->api->createLocation( "/News_1/TL1", "/News_2/" );
          }
      

      at ezpublishapitesthelper.php

          public function createLocation ( $contentPath, $parentLocationPath )
          {
              return $this->saveLocation(
                  $this->getContentInfoByPath( $contentPath ),
                  $this->newLocation( $parentLocationPath )
              );
          }
       
          public function saveLocation( ContentInfo $contentInfo, LocationCreateStruct $location )
          {
              $locationService = $this->repo->getLocationService();
              $newLocation = $locationService->createLocation( $contentInfo, $location );
       
              $this->addToHistory( static::ACTION_CREATE_LOCATION,
                  array(
                      'id' => $newLocation->id
                  )
              );
       
              return $newLocation;
          }
      

        Activity

        Hide
        Marcos Loureiro (Inactive) added a comment -

        Similar happens on delete, when it delete the location
        then it removes the object on the main location,
        but on second location it still shows the first location, however the link for it doesn't work.

        @file: ezpublishapilocations.php

            function _testTC625Locations__stage5()
            {
                // main node
                $this->api->deleteLocation( $this->api->getLocationByPath( "/News_1/TL1" )  );
                $this->api->deleteLocation( $this->api->getLocationByPath( "/News_2/TL1" )  );
            }

        @file: ezpublishapitesthelper.php

            public function deleteLocation( Location $location )
            {
                $this->repo->getLocationService()->deleteLocation( $location );
            }
         
        //....
         
            public function getLocationByPath( $path )
            {
                if( isset( $path[0] ) && $path[0] != '/' )
                {
                    print "  warning  Prefixed $path with a forward slash --> /$path\n";
                    $path = "/$path";
                }
         
                $urlAliasService = $this->repo->getURLAliasService();
                $locationService = $this->repo->getLocationService();
                $alias           = $urlAliasService->lookup( $path, $this->lang );
         
                return $locationService->loadLocation( $alias->destination );
            }

        Show
        Marcos Loureiro (Inactive) added a comment - Similar happens on delete, when it delete the location then it removes the object on the main location, but on second location it still shows the first location, however the link for it doesn't work. @file: ezpublishapilocations.php function _testTC625Locations__stage5() { // main node $this->api->deleteLocation( $this->api->getLocationByPath( "/News_1/TL1" ) ); $this->api->deleteLocation( $this->api->getLocationByPath( "/News_2/TL1" ) ); } @file: ezpublishapitesthelper.php public function deleteLocation( Location $location ) { $this->repo->getLocationService()->deleteLocation( $location ); }   //....   public function getLocationByPath( $path ) { if( isset( $path[0] ) && $path[0] != '/' ) { print " warning Prefixed $path with a forward slash --> /$path\n"; $path = "/$path"; }   $urlAliasService = $this->repo->getURLAliasService(); $locationService = $this->repo->getLocationService(); $alias = $urlAliasService->lookup( $path, $this->lang );   return $locationService->loadLocation( $alias->destination ); }
        Hide
        Marcos Loureiro (Inactive) added a comment -

        Found that both problems are resolved if the caches are cleaned.

        Show
        Marcos Loureiro (Inactive) added a comment - Found that both problems are resolved if the caches are cleaned.
        Hide
        Jérôme Vieilledent (Inactive) added a comment -

        Marcos Loureiro: What is the context of these tests when you run them ? Do you run them in a Symfony command ? If not, then this is perfectly normal as cache clearing process is mastered by EzPublishCoreBundle and EzPublishLegacyBundle.

        Show
        Jérôme Vieilledent (Inactive) added a comment - Marcos Loureiro : What is the context of these tests when you run them ? Do you run them in a Symfony command ? If not, then this is perfectly normal as cache clearing process is mastered by EzPublishCoreBundle and EzPublishLegacyBundle .
        Hide
        Marcos Loureiro (Inactive) added a comment -

        These tests are only made to test functionality of public API LocationService features, in no place on the code I use any kind of cache management, should I?

        Show
        Marcos Loureiro (Inactive) added a comment - These tests are only made to test functionality of public API LocationService features, in no place on the code I use any kind of cache management, should I?
        Hide
        Jérôme Vieilledent (Inactive) added a comment -

        It depends on how you test that the new location has been correctly created. If you test via web interface, then you will have cache issues

        Show
        Jérôme Vieilledent (Inactive) added a comment - It depends on how you test that the new location has been correctly created. If you test via web interface, then you will have cache issues
        Hide
        Marcos Loureiro (Inactive) added a comment -

        No, no, its all made by the public API, only verify on the interface if it is working.
        What I've done:
        through the Public API:
        1 - create content

        • folders "News_1" and "News_2"
        • artile "TL1" insice "News_1"
          2 - make a new location
        • create a new location for article "TL1" at "News_2"

        after this on admin2 interface
        1 - verify that exists "News_1" and inside "TL1"
        2 - verify on "/News_1/TL1" that it show 2 locations for it "eZ Publish/News_1/TL1" and "eZ Publish/News_2/TL1"
        (and its here where the problem is shown, it only shows "eZ Publish/News_1/TL1")
        3 - verify that exists "News_2" and inside "TL1"
        4 - verify on "/News_2/TL1" that it show 2 locations for it "eZ Publish/News_1/TL1" and "eZ Publish/News_2/TL1"
        (meanwhile here it shows both locations)

        Show
        Marcos Loureiro (Inactive) added a comment - No, no, its all made by the public API, only verify on the interface if it is working. What I've done: through the Public API: 1 - create content folders "News_1" and "News_2" artile "TL1" insice "News_1" 2 - make a new location create a new location for article "TL1" at "News_2" after this on admin2 interface 1 - verify that exists "News_1" and inside "TL1" 2 - verify on "/News_1/TL1" that it show 2 locations for it "eZ Publish/News_1/TL1" and "eZ Publish/News_2/TL1" (and its here where the problem is shown, it only shows "eZ Publish/News_1/TL1") 3 - verify that exists "News_2" and inside "TL1" 4 - verify on "/News_2/TL1" that it show 2 locations for it "eZ Publish/News_1/TL1" and "eZ Publish/News_2/TL1" (meanwhile here it shows both locations)
        Hide
        Jérôme Vieilledent (Inactive) added a comment -

        Marcos Loureiro: This is exactly the case I described. You're using the public API in a non-symfony context and then checks in the web GUI (with Symfony context) if the changes you made are visible. But as cache clearing stuff need the symfony context to be made, then it's not done.

        Short :

        • You do your API manipulation in your test, not in Symfony context (cli command or whatever)
          • As you're not using Symfony context, all events that are triggered by public API are not caught by Symfony and thus by the legacy stack
          • Consequence : Your change is not visible in the admin interface unless you manually clear the cache

        For the changes to be visible, you'll need to run your test in a Symfony command for example.

        Show
        Jérôme Vieilledent (Inactive) added a comment - Marcos Loureiro : This is exactly the case I described. You're using the public API in a non-symfony context and then checks in the web GUI (with Symfony context) if the changes you made are visible. But as cache clearing stuff need the symfony context to be made, then it's not done. Short : You do your API manipulation in your test, not in Symfony context (cli command or whatever) As you're not using Symfony context, all events that are triggered by public API are not caught by Symfony and thus by the legacy stack Consequence : Your change is not visible in the admin interface unless you manually clear the cache For the changes to be visible, you'll need to run your test in a Symfony command for example.
        Hide
        Marcos Loureiro (Inactive) added a comment -

        So the problem is in the test system.
        At the moment the work around will be to clear the cache manually.

        Show
        Marcos Loureiro (Inactive) added a comment - So the problem is in the test system. At the moment the work around will be to clear the cache manually.

          People

          • Assignee:
            Unassigned
            Reporter:
            Marcos Loureiro (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1 day
              1d
              Remaining:
              Time Spent - 1 hour Remaining Estimate - 7 hours
              7h
              Logged:
              Time Spent - 1 hour Remaining Estimate - 7 hours
              1h

                Agile