* Fields that you want to block from.
* getting copied
*
- * @return CRM_Core_DAO
- * the newly created copy of the object
+ * @return CRM_Core_DAO|bool
+ * the newly created copy of the object. False if none created.
*/
- public static function ©Generic($daoName, $criteria, $newData = NULL, $fieldsFix = NULL, $blockCopyOfDependencies = NULL) {
+ public static function copyGeneric($daoName, $criteria, $newData = NULL, $fieldsFix = NULL, $blockCopyOfDependencies = NULL) {
$object = new $daoName();
+ $newObject = FALSE;
if (!$newData) {
$object->id = $criteria['id'];
}
}
}
$newObject->save();
- if (!empty($newData['custom'])) {
- CRM_Core_BAO_CustomValueTable::store($newData['custom'], $newObject::getTableName(), $newObject->id);
- }
+ $newObject->copyCustomFields($object->id, $newObject->id);
CRM_Utils_Hook::post('create', CRM_Core_DAO_AllCoreTables::getBriefName($daoName), $newObject->id, $newObject);
}
/**
* Transform an array to a serialized string for database storage.
*
- * @param array|NULL $value
- * @param $serializationType
- * @return string|NULL
+ * @param array|null $value
+ * @param int $serializationType
+ * @return string|null
+ *
* @throws \Exception
*/
public static function serializeField($value, $serializationType) {