Puli\Repository\AbstractEditableRepository::__construct PHP 메소드

__construct() 공개 메소드

Create the repository.
public __construct ( Puli\Repository\Api\ChangeStream\ChangeStream $changeStream = null )
$changeStream Puli\Repository\Api\ChangeStream\ChangeStream If provided, the repository will log resources changes in this change stream.
    public function __construct(ChangeStream $changeStream = null)
    {
        $this->changeStream = $changeStream;
    }

Usage Example

예제 #1
0
 /**
  * Creates a new repository.
  *
  * @param string            $path          The path to the JSON file. If
  *                                         relative, it must be relative to
  *                                         the base directory.
  * @param string            $baseDirectory The base directory of the store.
  *                                         Paths inside that directory are
  *                                         stored as relative paths. Paths
  *                                         outside that directory are stored
  *                                         as absolute paths.
  * @param bool              $validateJson  Whether to validate the JSON file
  *                                         against the schema. Slow but
  *                                         spots problems.
  * @param ChangeStream|null $changeStream  If provided, the repository will
  *                                         append resource changes to this
  *                                         change stream.
  */
 public function __construct($path, $baseDirectory, $validateJson = false, ChangeStream $changeStream = null)
 {
     parent::__construct($changeStream);
     $this->baseDirectory = $baseDirectory;
     $this->path = Path::makeAbsolute($path, $baseDirectory);
     $this->encoder = new JsonEncoder();
     $this->encoder->setPrettyPrinting(true);
     $this->encoder->setEscapeSlash(false);
     if ($validateJson) {
         $this->schemaPath = Path::canonicalize(__DIR__ . '/../res/schema/path-mappings-schema-1.0.json');
     }
 }
All Usage Examples Of Puli\Repository\AbstractEditableRepository::__construct