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

        Marcos Loureiro (Inactive) created issue -
        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 ); }
        André Rømcke made changes -
        Field Original Value New Value
        Status Open [ 1 ] Backlog [ 10000 ]
        Marcos Loureiro (Inactive) made changes -
        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
        {noformat}

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

        {noformat}

        at ezpublishapitesthelper.php
        {noformat}
            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;
            }
        {noformat}
        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
        {noformat}

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

        {noformat}

        at ezpublishapitesthelper.php
        {code}
            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;
            }
        {code}
        Marcos Loureiro (Inactive) made changes -
        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
        {noformat}

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

        {noformat}

        at ezpublishapitesthelper.php
        {code}
            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;
            }
        {code}
        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
        {code

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

        at ezpublishapitesthelper.php
        {code}
            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;
            }
        {code}
        Marcos Loureiro (Inactive) made changes -
        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
        {code

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

        at ezpublishapitesthelper.php
        {code}
            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;
            }
        {code}
        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
        {code

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

        {code}

        at ezpublishapitesthelper.php
        {code}
            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;
            }
        {code}
        Marcos Loureiro (Inactive) made changes -
        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
        {code

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

        {code}

        at ezpublishapitesthelper.php
        {code}
            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;
            }
        {code}
        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
        {code}
            function _testTC625Locations__stage3()
            {
                $this->api->createLocation( "/News_1/TL1", "/News_2/" );
            }
        {code}

        at ezpublishapitesthelper.php
        {code}
            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;
            }
        {code}
        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.
        André Rømcke made changes -
        Rank Ranked higher
        André Rømcke made changes -
        Assignee André Rømcke [ andre.romcke@ez.no ]
        André Rømcke made changes -
        Remaining Estimate 1 day [ 28800 ]
        André Rømcke made changes -
        Original Estimate 1 day [ 28800 ]
        André Rømcke made changes -
        Rank Ranked higher
        André Rømcke made changes -
        Sprint Stetind Sprint 6 [ 7 ]
        André Rømcke made changes -
        Status Backlog [ 10000 ] Development [ 3 ]
        André Rømcke made changes -
        Status Development [ 3 ] Backlog [ 10000 ]
        Assignee André Rømcke [ andre.romcke@ez.no ]
        André Rømcke made changes -
        Rank Ranked higher
        André Rømcke made changes -
        Rank Ranked lower
        André Rømcke made changes -
        Status Backlog [ 10000 ] InputQ [ 10001 ]
        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.
        Marcos Loureiro (Inactive) made changes -
        Assignee Marcos Loureiro [ marcos.loureiro@ez.no ]
        Jérôme Vieilledent (Inactive) logged work - 27/Mar/13 5:01 PM
        • Time Spent:
          1 hour
           
          <No comment>
        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.
        Jérôme Vieilledent (Inactive) made changes -
        Status InputQ [ 10001 ] Development [ 3 ]
        Assignee Marcos Loureiro [ marcos.loureiro@ez.no ] Jerome Vieilledent [ jerome.vieilledent@ez.no ]
        Jérôme Vieilledent (Inactive) made changes -
        Remaining Estimate 1 day [ 28800 ] 7 hours [ 25200 ]
        Time Spent 1 hour [ 3600 ]
        Worklog Id 31435 [ 31435 ]
        Jérôme Vieilledent (Inactive) made changes -
        Status Development [ 3 ] Devlopment done [ 5 ]
        Jérôme Vieilledent (Inactive) made changes -
        Assignee Jerome Vieilledent [ jerome.vieilledent@ez.no ]
        Status Devlopment done [ 5 ] Closed [ 6 ]
        Resolution Invalid [ 6 ]
        André Rømcke made changes -
        Workflow eZ Engineering Scrumban Workflow [ 51846 ] EZ* Development Workflow [ 83503 ]
        Alex Schuster made changes -
        Workflow EZ* Development Workflow [ 83503 ] EZEE Development Workflow [ 122104 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Backlog Backlog
        3d 6h 48m 1 André Rømcke 04/Feb/13 7:54 PM
        Backlog Backlog Development Development
        14d 14h 28m 1 André Rømcke 19/Feb/13 10:22 AM
        Development Development Backlog Backlog
        7d 13m 1 André Rømcke 26/Feb/13 10:36 AM
        Backlog Backlog InputQ InputQ
        21d 9h 19m 1 André Rømcke 19/Mar/13 7:56 PM
        InputQ InputQ Development Development
        7d 21h 5m 1 jerome.vieilledent@ez.no 27/Mar/13 5:01 PM
        Development Development Development Done Development Done
        10s 1 jerome.vieilledent@ez.no 27/Mar/13 5:01 PM
        Development Done Development Done Closed Closed
        11s 1 jerome.vieilledent@ez.no 27/Mar/13 5:02 PM

          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