Skip to content

Commit

Permalink
Update DataObject.php
Browse files Browse the repository at this point in the history
PATCH: cleanup
  • Loading branch information
sunnysideup committed Jan 15, 2022
1 parent 1425146 commit 028687d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/ORM/DataObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@
* static $api_access = true;
*
* function canView($member = false) {
* if(!$member) $member = Security::getCurrentUser();
* if (!$member) $member = Security::getCurrentUser();
* return $member->inGroup('Subscribers');
* }
* function canEdit($member = false) {
* if(!$member) $member = Security::getCurrentUser();
* if (!$member) $member = Security::getCurrentUser();
* return $member->inGroup('Editors');
* }
*
Expand Down Expand Up @@ -3051,7 +3051,7 @@ public function can($perm, $member = null, $context = [])
*
* <code>
* $extended = $this->extendedCan('canDoSomething', $member);
* if($extended !== null) return $extended;
* if ($extended !== null) return $extended;
* else return $normalValue;
* </code>
*
Expand Down Expand Up @@ -3481,14 +3481,17 @@ public static function reset()
* @param int|bool $idOrCache The id of the element, or cache if called on target class
* @param boolean $cache See {@link get_one()}
*
* @return static The element
* @return static|null The element
*/
public static function get_by_id($classOrID, $idOrCache = null, $cache = true)
{
// Shift arguments if passing id in first or second argument
list ($class, $id, $cached) = is_numeric($classOrID)
? [get_called_class(), $classOrID, isset($idOrCache) ? $idOrCache : $cache]
: [$classOrID, $idOrCache, $cache];
? [get_called_class(), (int) $classOrID, isset($idOrCache) ? $idOrCache : $cache]
: [$classOrID, (int) $idOrCache, $cache];
if ($id < 1) {
return null;
}

// Validate class
if ($class === self::class) {
Expand Down

0 comments on commit 028687d

Please sign in to comment.