Storm\Core\Containers\Map::Map PHP Method

Map() public method

Maps an instance to another instance. Previous mappings for either instances are replaced.
public Map ( object $Instance, object $ToInstance ) : Map
$Instance object
$ToInstance object
return Map
    public function Map($Instance, $ToInstance)
    {
        if (!is_object($Instance) || !is_object($ToInstance)) {
            throw new \Storm\Core\StormException('Map only supports mapping object: %s and %s given', gettype($Instance), gettype($ToInstance));
        }
        if ($this->Storage->contains($Instance) || $this->InversedStorage->contains($Instance)) {
            $this->Unmap($Instance);
        }
        $this->MapNew($Instance, $ToInstance);
        return $this;
    }

Usage Example

Example #1
0
 protected function MapForeignKey2(Map $Map, ITable $Tags)
 {
     $Map->Map($this->TagId, $Tags->Id);
 }
All Usage Examples Of Storm\Core\Containers\Map::Map