/** * Remove instance from database * * @param integer $id * @return bool */ public function removeInstance($id) { $instance = $this->CollectionInstance->find($id); $this->Field->where('collection_instance_id', $id)->forceDelete(); return $instance ? $instance->delete() : false; }
/** * Find all fields where content requested is true for given * page version id and builds a list of field keys * * @param integer $pageVersionId * @return Field */ public function findContentRequestedFieldsList($pageVersionId) { return $this->Field->where('page_version_id', '=', $pageVersionId)->where('content_requested', '=', true)->select('id')->lists('id'); }
/** * Creates collection fields object from a collection * instance that we pulled from the database (those will * have fields associated with them too) * * @param CollectionInstance $instance * @return CollectionFields */ public function createFromCollectionInstance($instance) { $fields = $this->Field->where('collection_instance_id', '=', $instance->id)->where('page_version_id', '=', $instance->page_version_id)->get(); return new CollectionFields($fields); }