public final function __construct($uniqueIdentifier = null) { $this->modelName = SolutionSchema::getModelNameFromClass(get_class($this)); if ($this->modelName === null) { // If our model hasn't been registered with the SolutionSchema - we can still use it // However we will assume that the model name would have been just the last part of the // full class name. $this->modelName = basename(str_replace("\\", "/", get_class($this))); } $schema = $this->getSchema(); $this->uniqueIdentifierColumnName = $schema->uniqueIdentifierColumnName; if (!isset(self::$modelDataTransforms[$this->modelName])) { // Ensure we have our model transforms in place. self::$modelDataTransforms[$this->modelName] = []; $schema = $this->getSchema(); $columns = $schema->getColumns(); foreach ($columns as $column) { self::$modelDataTransforms[$this->modelName][$column->columnName] = [$column->getTransformFromModelData(), $column->getTransformIntoModelData()]; } } if ($uniqueIdentifier !== null) { $this->defaultsSet = true; $repository = $this->getRepository(); $repository->hydrateObject($this, $uniqueIdentifier); } parent::__construct(); }