X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/blobdiff_plain/0386c736fe19db9f72a9d12728f5707cf570778f..91b9f259d38073a9847ede172cdda1218f2c35fb:/src/relational-attributes.lisp diff --git a/src/relational-attributes.lisp b/src/relational-attributes.lisp deleted file mode 100644 index 7e17d58..0000000 --- a/src/relational-attributes.lisp +++ /dev/null @@ -1,117 +0,0 @@ -(in-package :lisp-on-lines) - -;;;; * Relational Attributes - - -;;;; ** has-a -;;;; Used for foreign keys, currently only works with clsql. - -(defattribute has-a () - () - (:default-properties - :has-a nil - :test 'meta-model::generic-equal)) - -;; -(define-layered-method attribute-value (object (attribute has-a)) - (meta-model:explode-foreign-key object (slot-name attribute) :nilp t)) - -(define-layered-method (setf attribute-value) ((value standard-object) object (attribute has-a)) - (let ((val (slot-value value (find-if (curry #'primary-key-p value) (list-keys value))))) - (setf (attribute-value object attribute) val))) - - - -(define-layered-function find-all-foreign-objects (o a)) - -(define-layered-method find-all-foreign-objects (object (attribute has-a)) - (select (meta-model:find-join-class object (slot-name attribute)) :flatp t)) - -(defdisplay ((attribute has-a) object) - (let ((args (plist-union (description.properties attribute) (has-a attribute))) - (val (attribute-value object attribute))) - (when val - (setf (getf args :type) - 'lol::one-line)) - (apply #'display* val - args))) - - -(defdisplay - :in-layer editor ((attribute has-a) object) - (