public function add($parameter, array $array)
    {

        if (!isset($this->$parameter)) {
            throw new \Exception("Supplied variable doesn't exist");
        }
        $array[$this->callingClassWithoutNamespace()] = $this;
        $up = ucfirst($parameter);
        $object = (dirname(get_class()) . "\\" . $up);
        $object = new $object();
        if (!$object instanceof ArraySerialize) {
            throw new \Exception("Object supplied not serialisable");
        }
        /** @var $object ToArray */
        $object->fromArray($array, $object);
        unset($array[$this->callingClassWithoutNamespace()]);
        $this->$parameter->add($object);
    }
public function add($parameter, array $array)
    {

        if (!isset($this->$parameter)) {
            throw new \Exception("Supplied variable doesn't exist");
        }
        $array[$this->callingClassWithoutNamespace()] = $this;
        $up = ucfirst($parameter);
        $object = (dirname(get_class()) . "\\" . $up);
        $object = new $object();
        if (!$object instanceof ArraySerialize) {
            throw new \Exception("Object supplied not serialisable");
        }
        /** @var $object ToArray */
        $object->fromArray($array, $object);
        unset($array[$this->callingClassWithoutNamespace()]);
        $this->$parameter->add($object);
    }
public function add ( $ parameter , array $ array ) { if ( ! isset ( $ this -> $ parameter ) ) { throw new \ Exception ( "Supplied variable doesn't exist" ) ; } $ array [ $ this -> callingClassWithoutNamespace ( ) ] = $ this ; $ up = ucfirst ( $ parameter ) ; $ object = ( dirname ( get_class ( ) ) . "\\" . $ up ) ; $ object = new $ object ( ) ; if ( ! $ object instanceof ArraySerialize ) { throw new \ Exception ( "Object supplied not serialisable" ) ; } /** @var $object ToArray */ $ object -> fromArray ( $ array , $ object ) ; unset ( $ array [ $ this -> callingClassWithoutNamespace ( ) ] ) ; $ this -> $ parameter -> add ( $ object ) ; }
Hide one To Many adding of a new entity

@param $parameter
@param array $array
@throws \Exception
@internal param array $object
Hide one To Many adding of a new entity