Cannot get name from a page with getCollectionName()

Permalink
I create a page oject ($page), from an existing page and try to get the name of the page with getCollectionName() (see code below).

I get an empty string back.

The version of concrete5 is 8.4.0

$page = Page::getByID(intval($links_item_v["link"], 0), 'APPROVED');
$content[] = $page->getCollectionName();
ob_start();
  var_dump($page); 
  $result = ob_get_contents();
ob_clean();
Log::addEntry("$links\r\n" . $result);
Log::addEntry($page->getCollectionName());


Log Enties
Jan 12, 2019, 8:00:52 PM Application admin
Jan 12, 2019, 8:00:52 PM Application admin

C:\Users\schmig\OneDrive\www\c5-8-4-0\packages\sg_common\src\sg_block_controller.php:41:
object(Concrete\Core\Page\Page)[2296]
protected 'controller' => null
protected 'blocksAliasedFromMasterCollection' => null
protected 'cPointerOriginalID' => null
protected 'cPointerExternalLink' => null
protected 'cPointerExternalLinkNewWindow' => string '0' (length=1)
protected 'isMasterCollection' => string '0' (length=1)
protected 'cInheritPermissionsFromCID' => string '1' (length=1)
protected 'cIsSystemPage' => string '0' (length=1)
protected 'siteTreeID' => string '1' (length=1)
public 'siteTree' => null
public 'cID' => string '218' (length=3)
protected 'vObj' =>
object(Concrete\Core\Page\Collection\Version\Version)[2282]
public 'cvID' => null
public 'cvIsApproved' => null
public 'cvIsNew' => null
public 'cvHandle' => null
public 'cvName' => null
public 'cvDescription' => null
public 'cvDateCreated' => null
public 'cvDatePublic' => null
public 'pTemplateID' => null
public 'cvAuthorUID' => null
public 'cvApproverUID' => null
public 'cvComments' => null
public 'pThemeID' => null
public 'cvPublishDate' => null
public 'cvPublishEndDate' => null
public 'cID' => string '218' (length=3)
protected 'attributes' =>
array (size=0)
empty
public 'layoutStyles' =>
array (size=0)
empty
protected 'isMostRecent' => null
protected 'customAreaStyles' => null
public 'error' => string '' (length=0)
protected 'cHandle' => null
protected 'cDateAdded' => string '2018-12-22 19:47:56' (length=19)
protected 'cDateModified' => string '2019-01-12 20:00:45' (length=19)
protected 'attributes' =>
array (size=0)
empty
public 'error' => boolean false
public 'pkgID' => string '0' (length=1)
public 'cPointerID' => string '0' (length=1)
public 'cIsDraft' => string '0' (length=1)
public 'cIsActive' => string '1' (length=1)
public 'cFilename' => null
public 'ptID' => string '5' (length=1)
public 'cDisplayOrder' => string '8' (length=1)
public 'cInheritPermissionsFrom' => string 'PARENT' (length=6)
public 'cOverrideTemplatePermissions' => string '1' (length=1)
public 'cCheckedOutUID' => null
public 'cIsTemplate' => string '0' (length=1)
public 'uID' => string '1' (length=1)
public 'cPath' => string '/misc' (length=5)
public 'cParentID' => string '1' (length=1)
public 'cChildren' => string '0' (length=1)
public 'cCacheFullPageContent' => string '-1' (length=2)
public 'cCacheFullPageContentOverrideLifetime' => string '0' (length=1)
public 'cCacheFullPageContentLifetimeCustom' => string '0' (length=1)

GunterSchmitt
 
mnakalay replied on at Permalink Best Answer Reply
mnakalay
You are using the 'APPROVED' argument but it doesn' exist. That argument has to be 'ACTIVE' or 'RECENT'
GunterSchmitt replied on at Permalink Reply
GunterSchmitt
Thank you,
this was a failure of myselfe.