Browse Source

Rename repositoryAlias to registryAlias

it refers to the key used in the table _registry_ to access the relevant
table object, rather than the alias of the table itself
AD7six 11 years ago
parent
commit
7f048d07ff
3 changed files with 18 additions and 18 deletions
  1. 4 4
      src/Datasource/EntityTrait.php
  2. 1 1
      src/ORM/Marshaller.php
  3. 13 13
      src/ORM/Table.php

+ 4 - 4
src/Datasource/EntityTrait.php

@@ -112,7 +112,7 @@ trait EntityTrait
      *
      * @var string
      */
-    protected $_repositoryAlias;
+    protected $_registryAlias;
 
     /**
      * Magic getter to access properties that have been set in this entity
@@ -812,9 +812,9 @@ trait EntityTrait
     public function source($alias = null)
     {
         if ($alias === null) {
-            return $this->_repositoryAlias;
+            return $this->_registryAlias;
         }
-        $this->_repositoryAlias = $alias;
+        $this->_registryAlias = $alias;
     }
 
     /**
@@ -843,7 +843,7 @@ trait EntityTrait
             'original' => $this->_original,
             'virtual' => $this->_virtual,
             'errors' => $this->_errors,
-            'repository' => $this->_repositoryAlias
+            'repository' => $this->_registryAlias
         ];
     }
 }

+ 1 - 1
src/ORM/Marshaller.php

@@ -107,7 +107,7 @@ class Marshaller
         $schema = $this->_table->schema();
         $entityClass = $this->_table->entityClass();
         $entity = new $entityClass();
-        $entity->source($this->_table->repositoryAlias());
+        $entity->source($this->_table->registryAlias());
 
         if (isset($options['accessibleFields'])) {
             foreach ((array)$options['accessibleFields'] as $key => $value) {

+ 13 - 13
src/ORM/Table.php

@@ -196,7 +196,7 @@ class Table implements RepositoryInterface, EventListenerInterface
      *
      * @var string
      */
-    protected $_repositoryAlias;
+    protected $_registryAlias;
 
     /**
      * A list of validation objects indexed by name
@@ -235,8 +235,8 @@ class Table implements RepositoryInterface, EventListenerInterface
      */
     public function __construct(array $config = [])
     {
-        if (!empty($config['repositoryAlias'])) {
-            $this->repositoryAlias($config['repositoryAlias']);
+        if (!empty($config['registryAlias'])) {
+            $this->registryAlias($config['registryAlias']);
         }
         if (!empty($config['table'])) {
             $this->table($config['table']);
@@ -361,18 +361,18 @@ class Table implements RepositoryInterface, EventListenerInterface
     /**
      * Returns the table registry key used to create this table instance
      *
-     * @param string|null $repositoryAlias the key used to access this object
+     * @param string|null $registryAlias the key used to access this object
      * @return string
      */
-    public function repositoryAlias($repositoryAlias = null)
+    public function registryAlias($registryAlias = null)
     {
-        if ($repositoryAlias !== null) {
-            $this->_repositoryAlias = $repositoryAlias;
+        if ($registryAlias !== null) {
+            $this->_registryAlias = $registryAlias;
         }
-        if ($this->_repositoryAlias === null) {
-            $this->_repositoryAlias = $this->alias();
+        if ($this->_registryAlias === null) {
+            $this->_registryAlias = $this->alias();
         }
-        return $this->_repositoryAlias;
+        return $this->_registryAlias;
     }
 
     /**
@@ -1406,7 +1406,7 @@ class Table implements RepositoryInterface, EventListenerInterface
                 $entity->clean();
                 $this->dispatchEvent('Model.afterSave', compact('entity', 'options'));
                 $entity->isNew(false);
-                $entity->source($this->repositoryAlias());
+                $entity->source($this->registryAlias());
                 $success = true;
             }
         }
@@ -1872,7 +1872,7 @@ class Table implements RepositoryInterface, EventListenerInterface
     {
         if ($data === null) {
             $class = $this->entityClass();
-            $entity = new $class(['source' => $this->repositoryAlias()]);
+            $entity = new $class(['source' => $this->registryAlias()]);
             return $entity;
         }
         if (!isset($options['associated'])) {
@@ -2036,7 +2036,7 @@ class Table implements RepositoryInterface, EventListenerInterface
             [
                 'useSetters' => false,
                 'markNew' => $options['newRecord'],
-                'source' => $this->repositoryAlias()
+                'source' => $this->registryAlias()
             ]
         );
         $fields = array_merge(