public function __construct($name, EntityReflection $entityReflection, $column, PropertyType $type, $isWritable, $isNullable, $containsCollection, $hasDefaultValue, $defaultValue = null, $relationship = null, PropertyMethods $propertyMethods = null, PropertyFilters $propertyFilters = null, PropertyPasses $propertyPasses = null, PropertyValuesEnum $propertyValuesEnum = null, array $customFlags = [])
{
if ($relationship !== null) {
if (!is_subclass_of($type->getType(), 'LeanMapper\\Entity')) {
throw new InvalidArgumentException("Property '{$name}' in entity {$entityReflection->getName()} cannot contain relationship since it doesn't contain entity (or collection of entities).");
}
if ($relationship instanceof Relationship\HasMany or $relationship instanceof Relationship\BelongsToMany) {
if (!$containsCollection) {
throw new InvalidArgumentException("Property '{$name}' with HasMany or BelongsToMany in entity {$entityReflection->getName()} relationship must contain collection.");
}
} else {
if ($containsCollection) {
throw new InvalidArgumentException("Property '{$name}' with HasOne or BelongsToOne in entity {$entityReflection->getName()} relationship cannot contain collection.");
}
}
if ($propertyPasses !== null) {
throw new InvalidArgumentException("Property '{$name}' in entity {$entityReflection->getName()} cannot have defined m:passThru since it contains relationship.");
}
} elseif ($propertyFilters !== null) {
throw new InvalidArgumentException("Cannot bind filter to property '{$name}' in entity {$entityReflection->getName()} since it doesn't contain relationship.");
}
if ($propertyValuesEnum !== null and (!$type->isBasicType() or $type->getType() === 'array' or $containsCollection)) {
throw new InvalidArgumentException("Values of property '{$name}' in entity {$entityReflection->getName()} cannot be enumerated.");
}
$this->name = $name;
$this->entityReflection = $entityReflection;
$this->column = $column;
$this->type = $type;
$this->isWritable = $isWritable;
$this->isNullable = $isNullable;
$this->containsCollection = $containsCollection;
$this->hasDefaultValue = $hasDefaultValue;
$this->defaultValue = $defaultValue;
$this->relationship = $relationship;
$this->propertyMethods = $propertyMethods;
$this->propertyFilters = $propertyFilters;
$this->propertyPasses = $propertyPasses;
$this->propertyValuesEnum = $propertyValuesEnum;
$this->customFlags = $customFlags;
}