<commit_before><?php

namespace Maghead\Runtime;

use PDOStatement;
use PDO;

use Exception;
use RuntimeException;
use InvalidArgumentException;
use BadMethodCallException;
use ArrayIterator;
use Serializable;
use ArrayAccess;

use Maghead\Runtime\Query\SelectQuery;
use Maghead\Runtime\Query\DeleteQuery;
use Maghead\Runtime\Query\UpdateQuery;

use Magsql\ToSqlInterface;
use Magsql\Universal\Query\InsertQuery;

use Magsql\Driver\PDOPgSQLDriver;
use Magsql\Driver\PDOMySQLDriver;
use Magsql\Bind;
use Magsql\ArgumentArray;
use Magsql\Raw;

use Maghead\Schema\RuntimeColumn;
use Maghead\Schema\Relationship\Relationship;
use Maghead\Exception\MissingPrimaryKeyException;
use Maghead\Exception\QueryException;
use SerializerKit\XmlSerializer;
use ActionKit;
use Symfony\Component\Yaml\Yaml;
use Countable;

use Maghead\Sharding\Traits\RepoShardTrait;
use Maghead\Sharding\Shard;

abstract class Repo implements Countable
{
    // Move this to Repo class Generator
    use RepoShardTrait;

    /**
     * @var string
     */
    protected $table;

    /**
     * @var string
     */
    protected $alias;


    /**
     * @var Maghead\Runtime\Connection
     */
    protected $write;

    /**
     * @var Maghead\Runtime\Connection
     */
    protected $read;


    /**
     * @var Maghead\Sharding\Shard
     */
    protected $shard;

    protected $_preparedCreateStms = [];

    /**
     * @var PDOStatement
     */
    protected $loadStm;

    /**
     * @var PDOStatement
     */
    protected $deleteStm;

    const SHARD_MAPPING_ID = null;

    const GLOBAL_TABLE = null;

    const SHARD_KEY = null;

    /**
     * Unset immutable args
     */
    abstract protected function unsetImmutableArgs($args);

    public function __construct(Connection $write, Connection $read = null, Shard $shard = null)
    {
        $this->write = $write;
        $this->read = $read ? $read : $write;
        $this->shard = $shard;
    }

    public function getReadConnection()
    {<commit_msg>add abstract method collection() on Repo class<commit_after><?php

namespace Maghead\Runtime;

use PDOStatement;
use PDO;

use Exception;
use RuntimeException;
use InvalidArgumentException;
use BadMethodCallException;
use ArrayIterator;
use Serializable;
use ArrayAccess;

use Maghead\Runtime\Query\SelectQuery;
use Maghead\Runtime\Query\DeleteQuery;
use Maghead\Runtime\Query\UpdateQuery;

use Magsql\ToSqlInterface;
use Magsql\Universal\Query\InsertQuery;

use Magsql\Driver\PDOPgSQLDriver;
use Magsql\Driver\PDOMySQLDriver;
use Magsql\Bind;
use Magsql\ArgumentArray;
use Magsql\Raw;

use Maghead\Schema\RuntimeColumn;
use Maghead\Schema\Relationship\Relationship;
use Maghead\Exception\MissingPrimaryKeyException;
use Maghead\Exception\QueryException;
use SerializerKit\XmlSerializer;
use ActionKit;
use Symfony\Component\Yaml\Yaml;
use Countable;

use Maghead\Sharding\Traits\RepoShardTrait;
use Maghead\Sharding\Shard;

abstract class Repo implements Countable
{
    // Move this to Repo class Generator
    use RepoShardTrait;

    /**
     * @var string
     */
    protected $table;

    /**
     * @var string
     */
    protected $alias;


    /**
     * @var Maghead\Runtime\Connection
     */
    protected $write;

    /**
     * @var Maghead\Runtime\Connection
     */
    protected $read;


    /**
     * @var Maghead\Sharding\Shard
     */
    protected $shard;

    protected $_preparedCreateStms = [];

    /**
     * @var PDOStatement
     */
    protected $loadStm;

    /**
     * @var PDOStatement
     */
    protected $deleteStm;

    const SHARD_MAPPING_ID = null;

    const GLOBAL_TABLE = null;

    const SHARD_KEY = null;

    /**
     * Unset immutable args
     */
    abstract protected function unsetImmutableArgs($args);

    /**
     * New collection object from this repo
     */
    abstract public function collection();

    public function __construct(Connection $write, Connection $read = null, Shard $shard = null)
    {
        $this->write = $write;
        $this->read = $read ? $read : $write;
        $this->shard = $shard;
    }

    public function getReadConnection()
    {
{'fraction_non_alphanumeric': 0.10187211281303185, 'fraction_numerical': 0.0, 'mean_word_length': 3.0773042616451933, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3584331', 'n_tokens_mistral': 1314, 'n_tokens_neox': 1280, 'n_words': 298}