Bravo3\Orm\Drivers\Common\Ref::fromString PHP Метод

fromString() публичный статический Метод

Create a ref from a string interpretation
public static fromString ( string $ref ) : Ref
$ref string
Результат Ref
    public static function fromString($ref)
    {
        $parts = explode(self::REF_DELIMITER, $ref, 3);
        if (count($parts) !== 3) {
            throw new UnexpectedValueException("Invalid ref string: " . $ref);
        }
        return new self($parts[0], $parts[1], $parts[2]);
    }

Usage Example

Пример #1
0
 /**
  * Get all refs to an entity
  *
  * @param string $key Entity ref key
  * @return Ref[]
  */
 public function getRefs($key)
 {
     $current = $this->worker_pool->execute(new Command('retrieve_index', ['key' => $key]));
     array_walk($current, function (&$item) {
         $item = Ref::fromString($item);
     });
     return $current;
 }
All Usage Examples Of Bravo3\Orm\Drivers\Common\Ref::fromString