function fromEntity($entity, $class, $repository, $callback = null)
    {
        $meta = $repository->fromClass($class);

        //Create the proxy object and set the meta, node, and load callback
        $proxy = $this->createProxy($meta);
        $proxy->__setMeta($meta);
        $proxy->__setEntity($entity);
        $proxy->__setLoadCallback($callback);
        $proxy->__setEntity($entity);

        //Set the primary key property in the object to the node id.
        $pk = $meta->getPrimaryKey();
        $pk->setValue($proxy, $entity->getId());
        $proxy->__addHydrated($pk->getName());

        //Set the properties
        foreach ($meta->getProperties() as $property)
        {
            $name = $property->getName();

            //If the value isn't null in the DB, set the property to the correct value
            if($value = $entity->getProperty($name))
            {
                $property->setValue($proxy, $value);
                $proxy->__addHydrated($name);
            }
        }

        return $proxy;

    }
function fromEntity($entity, $class, $repository, $callback = null)
    {
        $meta = $repository->fromClass($class);

        //Create the proxy object and set the meta, node, and load callback
        $proxy = $this->createProxy($meta);
        $proxy->__setMeta($meta);
        $proxy->__setEntity($entity);
        $proxy->__setLoadCallback($callback);
        $proxy->__setEntity($entity);

        //Set the primary key property in the object to the node id.
        $pk = $meta->getPrimaryKey();
        $pk->setValue($proxy, $entity->getId());
        $proxy->__addHydrated($pk->getName());

        //Set the properties
        foreach ($meta->getProperties() as $property)
        {
            $name = $property->getName();

            //If the value isn't null in the DB, set the property to the correct value
            if($value = $entity->getProperty($name))
            {
                $property->setValue($proxy, $value);
                $proxy->__addHydrated($name);
            }
        }

        return $proxy;

    }
function fromEntity ( $ entity , $ class , $ repository , $ callback = null ) { $ meta = $ repository -> fromClass ( $ class ) ; //Create the proxy object and set the meta, node, and load callback $ proxy = $ this -> createProxy ( $ meta ) ; $ proxy -> __setMeta ( $ meta ) ; $ proxy -> __setEntity ( $ entity ) ; $ proxy -> __setLoadCallback ( $ callback ) ; $ proxy -> __setEntity ( $ entity ) ; //Set the primary key property in the object to the node id. $ pk = $ meta -> getPrimaryKey ( ) ; $ pk -> setValue ( $ proxy , $ entity -> getId ( ) ) ; $ proxy -> __addHydrated ( $ pk -> getName ( ) ) ; //Set the properties foreach ( $ meta -> getProperties ( ) as $ property ) { $ name = $ property -> getName ( ) ; //If the value isn't null in the DB, set the property to the correct value if ( $ value = $ entity -> getProperty ( $ name ) ) { $ property -> setValue ( $ proxy , $ value ) ; $ proxy -> __addHydrated ( $ name ) ; } } return $ proxy ; }
Creates a proxy object for a Everyman node or relationship.

This creates a proxy object for a Everyman relationship, given the meta repository and class name

@param \Everyman\Neo4j\Node|\Everyman\Neo4j\Relationship $entity The entity to create a proxy of.
@param string $class The class name.
@param \LRezek\Arachnid\Meta\Repository $repository The meta repository.
@param null $callback The load callback to use for start/end nodes.
@return mixed The proxy object.
Creates a proxy object for a Everyman node or relationship .