Storm\Core\Object\IProperty::SetEntityMap PHP Method

SetEntityMap() public method

Sets the parent entity map.
public SetEntityMap ( Storm\Core\Object\IEntityMap $EntityMap = null ) : void
$EntityMap Storm\Core\Object\IEntityMap
return void
    public function SetEntityMap(IEntityMap $EntityMap = null);

Usage Example

Example #1
0
 /**
  * Adds a property to the given entity map.
  * 
  * @param \Storm\Core\Object\IProperty $Property The property to add
  * @return void
  * @throws InvalidPropertyException
  */
 private function AddProperty(IProperty $Property)
 {
     if ($Property->HasEntityMap()) {
         if (!$Property->GetEntityMap()->Is($this)) {
             throw new InvalidPropertyException('The supplied property is registered with another entity map %s.', get_class($Property->GetEntityMap()));
         }
     }
     $Property->SetEntityMap($this);
     $Identifier = $Property->GetIdentifier();
     if ($Property instanceof IDataProperty) {
         $this->DataProperties[$Identifier] = $Property;
         if ($Property->IsIdentity()) {
             $this->IdentityProperties[$Identifier] = $Property;
         }
     } else {
         if ($Property instanceof IEntityProperty) {
             $this->EntityProperties[$Identifier] = $Property;
         } else {
             if ($Property instanceof ICollectionProperty) {
                 $this->CollectionProperties[$Identifier] = $Property;
             } else {
                 throw new InvalidPropertyException('The supplied property must be of type %s, %s, %s: %s given', IDataProperty::IDataPropertyType, IEntityProperty::IEntityPropertyType, ICollectionProperty::ICollectionPropertyType, get_class($Property));
             }
         }
     }
     if ($Property instanceof IRelationshipProperty) {
         $this->RelationshipProperties[$Identifier] = $Property;
     }
     $this->Properties[$Identifier] = $Property;
 }
All Usage Examples Of Storm\Core\Object\IProperty::SetEntityMap