src/Controller/Component/UserToolComponent.php
protected function _getUserEntity($userId) {
		if (is_a($userId, EntityInterface::class)) {
			return $userId;
		}

		if (is_string($userId) || is_integer($userId)) {
			$entity = $this->UserTable->newEntity();

			return $this->UserTable->patchEntity(
				$entity,
				[$this->UserTable->primaryKey() => $userId],
				['guard' => false]
			);
		}

		if (is_array($userId)) {
			$entity = $this->UserTable->newEntity();

			return $this->UserTable->patchEntity(
				$entity,
				$userId,
				['guard' => false]
			);
		}
	}
protected function _getUserEntity($userId) {
		if (is_a($userId, EntityInterface::class)) {
			return $userId;
		}

		if (is_string($userId) || is_integer($userId)) {
			$entity = $this->UserTable->newEntity();

			return $this->UserTable->patchEntity(
				$entity,
				[$this->UserTable->primaryKey() => $userId],
				['guard' => false]
			);
		}

		if (is_array($userId)) {
			$entity = $this->UserTable->newEntity();

			return $this->UserTable->patchEntity(
				$entity,
				$userId,
				['guard' => false]
			);
		}
	}
protected function _getUserEntity ( $ userId ) { if ( is_a ( $ userId , EntityInterface :: class ) ) { return $ userId ; } if ( is_string ( $ userId ) || is_integer ( $ userId ) ) { $ entity = $ this -> UserTable -> newEntity ( ) ; return $ this -> UserTable -> patchEntity ( $ entity , [ $ this -> UserTable -> primaryKey ( ) => $ userId ] , [ 'guard' => false ] ) ; } if ( is_array ( $ userId ) ) { $ entity = $ this -> UserTable -> newEntity ( ) ; return $ this -> UserTable -> patchEntity ( $ entity , $ userId , [ 'guard' => false ] ) ; } }
Gets or constructs an user entity with a given id.

@param mixed array|int|string $userId User ID
@return \Cake\Datasource\EntityInterface
Gets or constructs an user entity with a given id .