'Integer', 'Link' => 'Url', 'Memo' => 'Text', ]; /** * @return string */ public function getDataType() { return $this->dataType; } /** * @param $dataType * * @return $this * @throws \Exception */ public function setDataType($dataType) { if (array_key_exists($dataType, self::$typeAliases)) { $dataType = self::$typeAliases[$dataType]; } if (!in_array($dataType, $this->getValidDataTypes())) { throw new \Exception(sprintf('Invalid data type "%s', $dataType)); } $this->dataType = $dataType; return $this; } /** * @return string */ public function getFkEntity() { return $this->fkEntity; } /** * @param string $fkEntity * * @return $this */ public function setFkEntity($fkEntity) { $this->fkEntity = $fkEntity; return $this; } /** * @return int */ public function getSerialize() { return $this->serialize; } /** * @param int|string|null $serialize * @return $this */ public function setSerialize($serialize) { if (is_string($serialize)) { $const = 'CRM_Core_DAO::SERIALIZE_' . $serialize; if (defined($const)) { $serialize = constant($const); } } $this->serialize = $serialize; return $this; } /** * Add valid types that are not not part of \CRM_Utils_Type::dataTypes * * @return array */ protected function getValidDataTypes() { $extraTypes = [ 'Boolean', 'Text', 'Float', 'Url', 'Array', 'Blob', 'Mediumblob', ]; $extraTypes = array_combine($extraTypes, $extraTypes); return array_merge(\CRM_Utils_Type::dataTypes(), $extraTypes); } }