public function byId($callerClass, $id, $cache = true, $requiredPerm = 'View')
    {
        $id = (int) $id;
        $item = DataObject::get_by_id($callerClass, $id, $cache);
        if ($item && $item->hasExtension('Restrictable') && $item->checkPerm($requiredPerm)) {
            return $item;
        }
        
        if ($item && !$item->hasExtension('Restrictable') && $item->canView()) {
            return $item;
        }
    }
public function byId($callerClass, $id, $cache = true, $requiredPerm = 'View')
    {
        $id = (int) $id;
        $item = DataObject::get_by_id($callerClass, $id, $cache);
        if ($item && $item->hasExtension('Restrictable') && $item->checkPerm($requiredPerm)) {
            return $item;
        }
        
        if ($item && !$item->hasExtension('Restrictable') && $item->canView()) {
            return $item;
        }
    }
public function byId ( $ callerClass , $ id , $ cache = true , $ requiredPerm = 'View' ) { $ id = ( int ) $ id ; $ item = DataObject :: get_by_id ( $ callerClass , $ id , $ cache ) ; if ( $ item && $ item -> hasExtension ( 'Restrictable' ) && $ item -> checkPerm ( $ requiredPerm ) ) { return $ item ; } if ( $ item && ! $ item -> hasExtension ( 'Restrictable' ) && $ item -> canView ( ) ) { return $ item ; } }
Return the given element, searching by ID

@param string $callerClass The class of the object to be returned
@param int $id The id of the element
@param boolean $cache See {@link get_one()}

@return DataObject The element
Return the given element searching by ID