src/Graviton/SchemaBundle/Constraint/ConstraintUtils.php
public function getSerializedEntity($documentClass, $recordId, array $fields = null)
    {
        if (is_array($fields)) {
            return $this->getSingleEntity($documentClass, $recordId, $fields);
        }

        if (!isset($this->entities[$documentClass][$recordId])) {
            $current = $this->getSingleEntity($documentClass, $recordId, $fields);

            if (is_null($current)) {
                $this->entities[$documentClass][$recordId] = null;
            } else {
                $this->entities[$documentClass][$recordId] = $current;
            }
        }

        return $this->entities[$documentClass][$recordId];
    }
public function getSerializedEntity($documentClass, $recordId, array $fields = null)
    {
        if (is_array($fields)) {
            return $this->getSingleEntity($documentClass, $recordId, $fields);
        }

        if (!isset($this->entities[$documentClass][$recordId])) {
            $current = $this->getSingleEntity($documentClass, $recordId, $fields);

            if (is_null($current)) {
                $this->entities[$documentClass][$recordId] = null;
            } else {
                $this->entities[$documentClass][$recordId] = $current;
            }
        }

        return $this->entities[$documentClass][$recordId];
    }
public function getSerializedEntity ( $ documentClass , $ recordId , array $ fields = null ) { if ( is_array ( $ fields ) ) { return $ this -> getSingleEntity ( $ documentClass , $ recordId , $ fields ) ; } if ( ! isset ( $ this -> entities [ $ documentClass ] [ $ recordId ] ) ) { $ current = $ this -> getSingleEntity ( $ documentClass , $ recordId , $ fields ) ; if ( is_null ( $ current ) ) { $ this -> entities [ $ documentClass ] [ $ recordId ] = null ; } else { $ this -> entities [ $ documentClass ] [ $ recordId ] = $ current ; } } return $ this -> entities [ $ documentClass ] [ $ recordId ] ; }
Gets a entity from the database as a generic object. All constraints that need the saved data to compare
values or anything should call this function to get what they need. As this is cached in the instance,
it will fetched only once even if multiple constraints need that object.

@param string $documentClass document class
@param string $recordId      record id
@param array  $fields        if you only need certain fields, you can specify them here

@throws \Exception

@return object|null entity
Gets a entity from the database as a generic object . All constraints that need the saved data to compare values or anything should call this function to get what they need . As this is cached in the instance it will fetched only once even if multiple constraints need that object .