src/snac/server/database/DBUtil.php
/**
     * List constellations most recent by status for any user
     *
     * Return a list of valid (but partial, summary) constellations for a single status, but for any user, and the most
     * recent version.
     *
     * List constellations that meet all these criteria: 1) most recent, 2) given status. User is ignored,
     * thus constellations owned by any user are returned.
     *
     * This will return the most recent version for the status. For reasons of sanity and
     * safety, status defaults to 'published'. This function will handle any status, including various locks,
     * deleted, embargoed. The given status is returned for any user, and always the most recent version.
     *
     * There is no question of this honoring deleted. If you ask for 'published' and the most recent is
     * 'published' then you get published. Deleted, or any other status does not come into the argument,
     * because we must always match "most recent". In other words, if you ask for publshed and the most recent
     * is not published, you won't get that constellation. There is no question of status when the status is
     * not the requested status. This is a bit odd because nearly everything else in DBUtil fills some other
     * need and therefore behaves otherwise.
     *
     * Note about default paramter values: Unfortunately, we have to accept null and default to null since php
     * cannot default to a constant or variable in a function signature. Also, php does not allow optional
     * parameters except the last parameter, so we have to accept null for $limit regardless.
     *
     * @param string $status optional Status defaults to 'published'.
     *
     * @param integer $limit optional Limit to the number of records. Not optional here. Must be -1 for all, or an
     * integer . Default to the config when missing.
     *
     * @param integer $offset optional An offset to jump into the list of records in the database. Optional defaults to
     * a config value. Must be -1 for all, or an integer. Default to the config when missing.
     *
     * @return \snac\data\Constellation[] A list of PHP constellation object, or false when there are no constellations.
     */
List constellations most recent by status for any user
Return a list of valid (but partial, summary) constellations for a single status, but for any user, and the most
recent version.

List constellations that meet all these criteria: 1) most recent, 2) given status. User is ignored,
thus constellations owned by any user are returned.

This will return the most recent version for the status. For reasons of sanity and
safety, status defaults to 'published'. This function will handle any status, including various locks,
deleted, embargoed. The given status is returned for any user, and always the most recent version.

There is no question of this honoring deleted. If you ask for 'published' and the most recent is
'published' then you get published. Deleted, or any other status does not come into the argument,
because we must always match "most recent". In other words, if you ask for publshed and the most recent
is not published, you won't get that constellation. There is no question of status when the status is
not the requested status. This is a bit odd because nearly everything else in DBUtil fills some other
need and therefore behaves otherwise.

Note about default paramter values: Unfortunately, we have to accept null and default to null since php
cannot default to a constant or variable in a function signature. Also, php does not allow optional
parameters except the last parameter, so we have to accept null for $limit regardless.

@param string $status optional Status defaults to 'published'.

@param integer $limit optional Limit to the number of records. Not optional here. Must be -1 for all, or an
integer . Default to the config when missing.

@param integer $offset optional An offset to jump into the list of records in the database. Optional defaults to
a config value. Must be -1 for all, or an integer. Default to the config when missing.

@return \snac\data\Constellation[] A list of PHP constellation object, or false when there are no constellations.
List constellations most recent by status for any user Return a list of valid ( but partial summary ) constellations for a single status but for any user and the most recent version . List constellations that meet all these criteria : 1 ) most recent 2 ) given status . User is ignored thus constellations owned by any user are returned . This will return the most recent version for the status . For reasons of sanity and safety status defaults to ' published ' . This function will handle any status including various locks deleted embargoed . The given status is returned for any user and always the most recent version . There is no question of this honoring deleted . If you ask for ' published ' and the most recent is ' published ' then you get published . Deleted or any other status does not come into the argument because we must always match " most recent " . In other words if you ask for publshed and the most recent is not published you won ' t get that constellation . There is no question of status when the status is not the requested status . This is a bit odd because nearly everything else in DBUtil fills some other need and therefore behaves otherwise . Note about default paramter values : Unfortunately we have to accept null and default to null since php cannot default to a constant or variable in a function signature . Also php does not allow optional parameters except the last parameter so we have to accept null for $limit regardless . @param string $status optional Status defaults to ' published ' . @param integer $limit optional Limit to the number of records . Not optional here . Must be - 1 for all or an integer . Default to the config when missing . @param integer $offset optional An offset to jump into the list of records in the database . Optional defaults to a config value . Must be - 1 for all or an integer . Default to the config when missing . @return \ snac \ data \ Constellation [] A list of PHP constellation object or false when there are no constellations .
public function listConstellationsWithStatusForAny($status='published',
                                                       $limit=null,
                                                       $offset=null)
    {
        if ($limit==null || ! is_int($limit))
        {
            $limit = \snac\Config::$SQL_LIMIT;
        }
        if ($offset == null || ! is_int($offset))
        {
            $offset = \snac\Config::$SQL_OFFSET;
        }
        $infoList = $this->sql->selectListByStatus($status, $limit, $offset);
        if ($infoList)
        {
            $constellationList = array();
            foreach ($infoList as $idVer)
            {
                $cObj = $this->readConstellation($idVer['ic_id'], $idVer['version'], DBUtil::$READ_NRD | DBUtil::$READ_PREFERRED_NAME);
                array_push($constellationList, $cObj);
            }
            return $constellationList;
        }
        return false;
    }
public function listConstellationsWithStatusForAny ( $ status = 'published' , $ limit = null , $ offset = null ) { if ( $ limit == null || ! is_int ( $ limit ) ) { $ limit = \ snac \ Config :: $ SQL_LIMIT ; } if ( $ offset == null || ! is_int ( $ offset ) ) { $ offset = \ snac \ Config :: $ SQL_OFFSET ; } $ infoList = $ this -> sql -> selectListByStatus ( $ status , $ limit , $ offset ) ; if ( $ infoList ) { $ constellationList = array ( ) ; foreach ( $ infoList as $ idVer ) { $ cObj = $ this -> readConstellation ( $ idVer [ 'ic_id' ] , $ idVer [ 'version' ] , DBUtil :: $ READ_NRD | DBUtil :: $ READ_PREFERRED_NAME ) ; array_push ( $ constellationList , $ cObj ) ; } return $ constellationList ; } return false ; }
List constellations most recent by status for any user
 Return a list of valid (but partial, summary) constellations for a single status, but for any user, and the most
 recent version.
List constellations most recent by status for any user Return a list of valid ( but partial summary ) constellations for a single status but for any user and the most recent version .