MOON
Server: Apache
System: Linux server1.studioinfinity.com.br 2.6.32-954.3.5.lve1.4.90.el6.x86_64 #1 SMP Tue Feb 21 12:26:30 UTC 2023 x86_64
User: artinside (517)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/artinside/sites.artinside.com.br/festival/source/Models/Ecommerce/ProductVariations.php
<?php

namespace Source\Models\Ecommerce;

use Source\Core\Model;

/**
 * Class ProductVariations
 * @package Source\Models\Ecommerce
 */
class ProductVariations extends Model
{
    /**
     * Post constructor.
     */
    public function __construct()
    {
        parent::__construct("product_variations", ["id"], ["product_id", "width", "height", "depth", "weight", "price"]);
    }


    /**
     * @param string $gallery_link
     * @param string $columns
     * @return null|Post
     */

    public function findByGLink(string $gallery_link, string $columns = "*"): ?ProductVariations
    {
        $find = $this->find("gallery_link = :gallery_link", "gallery_link={$gallery_link}", $columns);
        return $find->fetch();
    }


    /**
     * @return null|Product
     */
    public function product(): ?Product
    {
        if ($this->product_id) {
            return (new Product())->find("gallery_link = :gl", "gl={$this->product_id}")->fetch();
        }
        return null;
    }

}