private function __construct() { $this->hydrator = new ConstructorlessHydrator(); $this->connection = Connection::getConnection(); $this->cache = new EntityCache(); }
<?php namespace DaybreakStudios\Link\Demos; use DaybreakStudios\Link\Connection\Adapter\MySqlPdoAdapter; use DaybreakStudios\Link\Connection\Connection; use DaybreakStudios\Link\Entity\Entity; require __DIR__ . '/vendor/autoload.php'; $conn = Connection::create(new MySqlPdoAdapter('link_demo', '127.0.0.1', 'root', '')); /** * @method int getId() * @method string getBirthplace() * @method $this setBirthplace(string $birthplace) * @method int getAge() * @method $this setAge(int $age) */ class Biography extends Entity { } /** * @method int getId() * @method string getContent() * @method $this setContent(string $content) * @method \DateTime getPostedOn() * @method $this setPostedOn(\DateTime $postedOn) * @method bool isDeleted() * @method $this setDeleted(bool $deleted) * @method string getTitle() * @method $this setTitle(string $title) * @method User getUser() * @method string getUserEmail()
public function __construct($ast, $ctx = null, Connection $connection = null) { $this->ast = $ast; $this->ctx = $ctx; $this->connection = $connection ?? Connection::getConnection(); }
<?php require_once __DIR__ . '/vendor/autoload.php'; $adapter = new \DaybreakStudios\Link\Connection\Adapter\MySqlPdoAdapter('link_demo', '127.0.0.1', 'root', ''); $connection = \DaybreakStudios\Link\Connection\Connection::create($adapter); return new \Symfony\Component\Console\Helper\HelperSet(['connection' => new \DaybreakStudios\Link\Console\Helper\ConnectionHelper($connection), 'destination' => new \DaybreakStudios\Link\Console\Helper\DestinationHelper(__DIR__ . '/entities')]);
/** * @return string */ public function getSchema() : string { return $this->connection->getSchema(); }