Skip to content

Instantly share code, notes, and snippets.

@Baruch4413
Baruch4413 / gist:7c192564a4d3efc79ff425790cd89ce0
Created September 10, 2021 15:31 — forked from kwatch/gist:02b1a5a8899b67df2623
Example to support 'geometry' type (on PostgreSQL) in SQLAlchemy
from sqlalchemy import func
from sqlalchemy.types import UserDefinedType, Float
class EasyGeometry(UserDefinedType):
def get_col_spec(self):
return "GEOMETRY"
def bind_expression(self, bindvalue):
<?php
namespace Qc\Helpers;
use Phalcon\Mvc\View;
class ListingHelper extends \Phalcon\Tag
{
public function renderField($field, $data){
$config = $this->getDI()->get('config');
<?php
namespace Qc\Models;
class Specimens extends \Phalcon\Mvc\Model
{
public function initialize(){
$this->belongsTo(
"sample_id",
"Qc\\Models\\Samples",
"id"
);
<?php
namespace Qc\Models;
class Samples extends \Phalcon\Mvc\Model
{
public function initialize(){
$this->hasMany(
"id",
"Qc\\Models\\Specimens",
"sample_id"
);