sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function connect() { if ($this->_connection) { return true; } $config = $this->_config; $config['init'][] = "ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS' NLS_TIMESTAMP_FORMAT='YYYY-MM-DD HH24:MI:SS' NLS_TIMESTAMP_TZ_FORMAT='YYYY-MM-DD HH24:MI:SS'"; ...
{@inheritDoc}
entailment
public function prepare($query) { $this->connect(); $isObject = ($query instanceof Query); $queryStringRaw = $isObject ? $query->sql() : $query; $queryString = $this->_fromDualIfy($queryStringRaw); $yajraStatement = $this->_connection->prepare($queryString); $oci8Stat...
{@inheritDoc} @return \Cake\Oracle\Statement\OracleStatement
entailment
protected function _fromDualIfy($queryString) { $statement = strtolower(trim($queryString)); if (strpos($statement, 'select') !== 0 || preg_match('/ from /', $statement)) { return $queryString; } //Doing a SELECT without a FROM (e.g. "SELECT 1 + 1") does not work in Oracl...
Add "FROM DUAL" to SQL statements that are SELECT statements with no FROM clause specified @param string $queryString query @return string
entailment
protected function _foreignKeySQL($enableDisable) { $startQuote = $this->_startQuote; $endQuote = $this->_endQuote; if (!empty($this->_config['schema'])) { $schemaName = strtoupper($this->_config['schema']); $fromWhere = "from sys.all_constraints where...
Get the SQL for enabling or disabling foreign keys @param string $enableDisable "enable" or "disable" @return string
entailment
public function lastInsertId($sequence = null, $ignored = null) { $this->connect(); if (!empty($sequence) && !empty($this->_connection)) { $reflection = new ReflectionObject($this->_connection); $property = $reflection->getProperty('table'); $property->setAccessi...
Returns last id generated for a table or sequence in database Override info: Yajra expects sequence name to be passed in, but Cake typically passes in table name. Yajra already has logic to guess sequence name based on last-inserted-table name ("{tablename}_id_seq") IF null is passed in, so we'll take a peek at that "l...
entailment
public function boot() { $this->publishes([ __DIR__.'/../config/propel.php' => config_path('propel.php'), ]); // load pregenerated config if (file_exists(app_path() . '/propel/config.php')) { Propel::init(app_path() . '/propel/config.php'); } else { ...
Bootstrap the application events. @return void
entailment
protected function registerRuntimeConfiguration() { $propel_conf = $this->app->config['propel.propel']; if ( ! isset($propel_conf['runtime']['connections']) ) { throw new \InvalidArgumentException('Unable to guess Propel runtime config file. Please, initialize the "propel.runtime" param...
Register propel runtime configuration. @return void
entailment
protected function registerPropelAuth() { $command = false; if (\App::runningInConsole()) { $input = new ArgvInput(); $command = $input->getFirstArgument(); } // skip auth driver adding if running as CLI to avoid auth model not found if ('propel:mode...
Register propel auth provider. @return void
entailment
public function register() { $finder = new Finder(); $finder->files()->name('*.php')->in(__DIR__.'/../../../propel/propel/src/Propel/Generator/Command')->depth(0); $commands = []; foreach ($finder as $file) { $ns = '\\Propel\\Generator\\Command'; $r = new \R...
Register the service provider. @return void
entailment
protected function _buildOffsetPart($offset, $query) { if (intval($offset) < 1) { return ''; } $origEpilog = $query->clause('epilog'); if (is_array($origEpilog) && array_key_exists('snelgOracleOrigEpilog', $origEpilog)) { $origEpilog = $origEpilog['snelgOracl...
Generates the OFFSET part of a SQL query. Due to the way Oracle ROWNUM works, if you want an offset *without* a limit, you still need to add a similar subquery as you use with a limit. @param int $offset the offset clause @param \Cake\Database\Query $query The query that is being compiled @return string
entailment
protected function _buildLimitPart($limit, $query) { if (intval($limit) < 1) { return ''; } $endRow = intval($query->clause('offset')) + $limit; $origEpilog = $query->clause('epilog'); $offsetEndWrap = ''; if (is_array($origEpilog) && array_key_exists('sn...
Generates the LIMIT part of a SQL query @param int $limit the limit clause @param \Cake\Database\Query $query The query that is being compiled @return string
entailment
protected function _buildEpilogPart($epilog, $query, $generator) { if (!is_array($epilog) || !array_key_exists('snelgOracleOrigEpilog', $epilog)) { $origEpilog = $epilog; } else { //We wrapped the original epilog, which might have been an //ExpressionInterface ins...
Generates the EPILOG part of a SQL query, including special handling if we added offset and/or limit wrappers earlier @param mixed $epilog the epilog clause @param \Cake\Database\Query $query The query that is being compiled @param \Cake\Database\ValueBinder $generator The placeholder and value binder object @return s...
entailment
public function resolveComponentData(ResolveComponentModelIdentifier $resolve) { $model = $resolve->getModel(); $identifier = $resolve->getIdentifier(); $data = null; if (is_object($model)) { $data = $model; $modelClass = get_class($model); if (!...
{@inheritdoc}
entailment
public function create($operator, $value) { $this->operator = $operator; $this->value = $value; return $this; }
@param string $operator operator @param mixed $value value @return Asserter
entailment
public function fromArray(array $data) { list ($field, $operator, $value) = $data['value']; return $this->field($field) ->create($operator, $value) ; }
{@inheritdoc}
entailment
public function filter($collection) { if (empty($this->locators)) { return $collection; } foreach ($collection as $key => $action) { if ($action instanceof TimelineInterface) { $action = $action->getAction(); } $entry = new En...
{@inheritdoc}
entailment
protected function hydrateComponents($collection) { $componentsLocated = array(); foreach ($this->components as $model => $components) { foreach ($this->locators as $locator) { if ($locator->supports($model)) { $locator->locate($model, $components); ...
Use locators to hydrate components. @param mixed $collection collection @throws \Exception @return mixed
entailment
private function guardValidIdentifier($identifier) { if (null === $identifier || '' === $identifier) { throw new ResolveComponentDataException('No resolved identifier given'); } if (!is_scalar($identifier) && !is_array($identifier)) { throw new ResolveComponentDataEx...
Guard valid identifier. The identifier can not be empty (but can be zero) and has to be a scalar or array. @param string|array $identifier @throws ResolveComponentDataException
entailment
private function guardValidModelAndIdentifier($model, $identifier) { if (empty($model) || (!is_object($model) && (null === $identifier || '' === $identifier))) { throw new ResolveComponentDataException('Model has to be an object or (a scalar + an identifier in 2nd argument)'); } }
@param $model @param $identifier @throws \Spy\Timeline\Exception\ResolveComponentDataException
entailment
protected function getFileHandler() { try { return parent::getFileHandler(); } catch (\MVar\LogParser\Exception\ParserException $exception) { throw new ParserException($exception->getMessage(), $exception->getCode(), $exception); } }
{@inheritdoc}
entailment
protected function openFileObject($mode, $skipEmptyLines) { if (!$this->getParent()->isDir()) { $this->getParent()->mkdirs(); } $newFile = false; if (!$this->isFile()) { switch ($mode) { case 'w': case 'w+': ...
file mode r = read only, beginning of file r+ = read and write, beginning of file w = write only, beginning of file, empty file, create file if necessary w+ = read and write, beginning of file, empty file, create file if nesessary a = write only, end of file, create file if necessary a+ = read and ...
entailment
public function readLines() { if ($this->getFileObject()->isFile()) { if ($this->skipEmptyLines) { // skip empty lines $lines = file($this->getFileObject()->getPathname(), FILE_SKIP_EMPTY_LINES | FILE_IGNORE_NEW_LINES); } else { $lines ...
return an array with all lines of a file @return array file lines
entailment
public function build() { foreach ($this->action->getActionComponents() as $actionComponent) { if (!$actionComponent->isText()) { $this->buildComponent($actionComponent); } } }
Build references (subject, directComplement, indirectComplement) of timeline action
entailment
public function onKernelRequest(GetResponseEvent $event): void { if ('sonata_admin_dashboard' === $event->getRequest()->get('_route')) { $modelManager = $this->admin->getModelManager(); $defaultDashboard = $modelManager->findOneBy($this->admin->getClass(), [ 'default...
Filter the `kernel.request` event to catch the dashboardAction.
entailment
public function render($indent = "\t") { $html = ''; foreach(self::$storage as $meta) { $html .= $indent . $meta->render() . PHP_EOL; } return $html; }
Render all meta tags @return String
entailment
public function addMeta($property, $content, $position) { $content = $this->_normalizeContent($property, $content); switch($property) { case self::OG_TITLE: case self::OG_TYPE: case self::OG_DESCRIPTION: case self::OG_LOCALE: case self::OG...
Add meta @param String $property @param Mixed $content @param String $position @return \Opengraph\Opengraph
entailment
public function hasMeta($property) { foreach(static::$storage as $meta) { if($meta->getProperty() == $property) { return true; } } return false; }
Check is meta exists @param String $property @return Boolean
entailment
public function getMeta($property) { foreach(static::$storage as $meta) { if($meta->getProperty() == $property) { return $meta->getContent(); } } return false; }
Get meta by property name @param String $property @return \Opengraph\Meta
entailment
public function removeMeta($property) { foreach(static::$storage as $i => $meta) { if($meta->getProperty() == $property) { unset(static::$storage[$i]); return true; } } return false; }
Remove meta @param String $property @return Boolean
entailment
protected function _normalizeContent($property, $content) { if($property == self::FB_ADMINS && is_string($content)) { return (array)explode(',', $content); } return $content; }
Normalize content @param String $property @param Mixed $content @return Mixed
entailment
public function getArrayCopy() { $graph = array(); $metas = static::$storage->getArrayCopy(); foreach($metas as $i => $meta) { $property = $meta->getProperty(); $content = $meta->getContent(); switch($property) { case self::OG_IMA...
Get array @return Array
entailment
public function getExtension() { if (version_compare(PHP_VERSION, '5.3.6') >= 0) { return parent::getExtension(); } else { return ltrim(pathinfo($this->getAbsolutePath(), PATHINFO_EXTENSION), '.'); } }
return file extension. method was implemented as of version 5.3.6, we will therefore check, which version we got and extract the extension on our own otherwise @return string
entailment
public function isAbsolute() { $filepath = $this->getPathname(); if (isset($filepath[0]) && $filepath[0] == self::PATH_SEPARATOR) { return true; } return false; }
return if file path is absolute @return bool
entailment
public function getAbsolutePath() { if (!$this->isAbsolute()) { $filepath = stream_resolve_include_path($this->getPathname()); } else { $filepath = realpath($this->getPathname()); } return $filepath; }
return absolute file path @return string
entailment
public function touch($modificationTime = null, $accessTime = null) { if ($this->isFile()) { if (is_null($modificationTime)) { $modificationTime = time(); } if (is_null($accessTime)) { $accessTime = $modificationTime; } ...
touch set access and modification time to file @param int $modificationTime optional unix timestamp of modification time, default is current time @param int $accessTime optional unix timestamp of access time. default is the modification time @return bool @throws FileExce...
entailment
public function createNewFile($mode = null) { if ($this->isAbsolute()) { if (is_null($mode)) { $mode = $this->defaul_permission; } if ($resource = fopen($this->getPathname(), 'x')) { fclose($resource); $this->chmod($mode); ...
create a empty file, named by the pathname @param int $mode optional file permission @return bool returns true if the file was successfully created @throws FileException
entailment
public function mkdir($mode = null) { if ($this->isAbsolute()) { if (is_null($mode)) { $mode = $this->defaul_permission; } if (mkdir($this->getPathname())) { $this->chmod($mode); return true; } retur...
create a directory (but not the parent directories) @param int $mode optional file permission @return bool @throws FileException
entailment
public function delete() { if ($this->isAbsolute()) { if ($this->isFile() || $this->isLink()) { // delete file and symlink return unlink($this->getPathname()); } elseif ($this->isDir()) { // delete directory return rmdir...
delete the file or empty directory of the current file path @return bool true if file or directory was deleted, false if file or directory was not found @throws FileException
entailment
public function deleteAll() { if ($this->isAbsolute()) { if ($this->isFile() || $this->isLink()) { // delete file and symlink return unlink($this->getPathname()); } elseif ($this->isDir()) { // delete directories and its content ...
delete the file or directory with its content of the current file path @return bool true if file or directory was deleted, false if file or directory was not found @throws FileException
entailment
public function deleteFiles() { if ($this->isAbsolute()) { if ($this->isDir()) { // delete files in the current directory return $this->deleteFilesAction($this->getPathname(), false); } else { throw new FileException('Given path is a fi...
delete files of the current directory @return bool true if files were deleted @throws FileException @throws Exception\FileFilterException
entailment
public function deleteAllFiles() { if ($this->isAbsolute()) { if ($this->isDir()) { // delete files in the current directory and it's subdirectories return $this->deleteFilesAction($this->getPathname(), true); } else { throw new FileExc...
delete files of the current directory recursive @return bool true if files were deleted @throws FileException @throws Exception\FileFilterException
entailment
public function rename($pathname) { if (!empty($pathname)) { if ($this->exists()) { $targetPathname = $this->getPath() . self::PATH_SEPARATOR . (string)$pathname; if (rename($this->getPathname(), $targetPathname)) { parent::__construct($targetP...
rename file @param string $pathname directory or file name with extension @return bool @throws FileException
entailment
public function move($pathname) { if (!empty($pathname)) { if ($pathname instanceof \SplFileInfo) { $targetFile = $pathname; } else { $targetFile = new File($pathname); } if ($this->exists()) { if ($targetFile->...
move file to a given directory @param \SplFileInfo|string $pathname @return bool @throws FileException
entailment
public function copy($pathname) { if (!empty($pathname)) { if ($pathname instanceof \SplFileInfo) { $targetFile = $pathname; } else { $targetFile = new File($pathname); } if ($targetFile->isDir()) { $targetPathn...
copy file to a given directory @param \SplFileInfo|string $pathname @return bool @throws FileException
entailment
public function getOwnerName() { $userId = $this->getOwner(); if ($userId) { $userData = posix_getpwuid($userId); return ((isset($userData['name'])) ? $userData['name'] : null); } return false; }
return user name of the file or directory @return string user name of file owner
entailment
public function getGroupName() { $userId = $this->getGroup(); if ($userId) { $userData = posix_getgrgid($userId); return ((isset($userData['name'])) ? $userData['name'] : null); } return false; }
return user group name of the file or directory @return string|bool|null user group name of file group
entailment
public function chown($user) { if ($this->exists() && (is_string($user) || is_int($user)) ) { if (!empty($user)) { return chown($this->getPathname(), $user); } else { throw new FileException('Chown failed, because given user is empt...
change owner @param string|int $user user name or id @return bool @throws FileException
entailment
public function chmod($fileMode) { if ($this->exists()) { // file mode must be from type octal. through converting octal to decimal and the other way around // we going sure that the given value is a octal. Any non octal number will be detected. if (decoct(octdec($fileMod...
change permission @param int|string $fileMode file permission, default permission is 0777 @return bool @throws FileException
entailment
public function getSize() { $filePath = $this->getPathname(); $size = -1; $isWin = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'); $execWorks = (function_exists('exec') && !ini_get('safe_mode') && exec('echo EXEC') == 'EXEC'); if ($isWin) { if ($execWorks) { ...
return file size in bytes @return int filesize in bytes or -1 if it fails
entailment
public function listAll() { $iterator = new \FilesystemIterator($this->getAbsolutePath()); $iterator->setInfoClass(get_class($this)); return $iterator; }
returns files and directories @return \FilesystemIterator
entailment
public function listFiles() { $innerIterator = new \FilesystemIterator($this->getAbsolutePath()); $innerIterator->setInfoClass(get_class($this)); $iterator = new FileFilterType($innerIterator, 'file'); return $iterator; }
returns files @return \FilesystemIterator|FileFilterType @throws Exception\FileFilterException
entailment
public function createFromHash($hash) { $data = explode('#', $hash); if (count($data) == 1) { throw new \InvalidArgumentException('Invalid hash, must be formatted {model}#{hash or identifier}'); } $model = array_shift($data); $identifier = unserialize(implod...
{@inheritdoc}
entailment
public function setModel($model) { $this->model = $model; if (null !== $this->getIdentifier()) { $this->buildHash(); } return $this; }
{@inheritdoc}
entailment
public function setIdentifier($identifier) { if (is_scalar($identifier)) { // to avoid issue of serialization. $identifier = (string) $identifier; } elseif (!is_array($identifier)) { throw new \InvalidArgumentException('Identifier must be a scalar or an array'); ...
{@inheritdoc}
entailment
public function toArray() { $criterias = array_map(function ($criteria) { return $criteria->toArray(); }, $this->getCriterias()); return array( 'type' => 'operator', 'value' => $this->getType(), 'criterias' => $criterias, ); ...
{@inheritdoc}
entailment
public function fromArray(array $data, QueryBuilderFactory $factory) { $criterias = array_map(function ($v) use ($factory) { if ('operator' == $v['type']) { return $factory->createOperatorFromArray($v); } elseif ('expr' == $v['type']) { return $factory...
{@inheritdoc}
entailment
public function handle(Config $config) { $sampleOption = $this->option('sample'); $type = 'empty'; if( $sampleOption ) { $type = 'sample'; } $from = __DIR__ . '/../../resources/'.$type.'_schema.xml'; $to = $config->get('propel.propel.paths.schema...
Execute the console command. @param Config $config @return mixed @throws \Exception
entailment
static public function init(LockHandlerInterface $lockHandler) { if (is_null(self::$singletonObject)) { self::$singletonObject = new self($lockHandler); } return self::$singletonObject; }
singleton @static @param LockHandlerInterface $lockHandler @return LockManager
entailment
public function createNewOperator($type, array $args) { if (empty($args) || count($args) < 2) { throw new \InvalidArgumentException(__METHOD__.' accept minimum 2 arguments'); } return $this->factory ->createOperator() ->setType($type) ->setCri...
@param string $type type @param array $args args @return Operator
entailment
public function orderBy($field, $order) { if (!in_array($field, $this->getAvailableFields())) { throw new \InvalidArgumentException(sprintf('Field "%s" not supported, prefer: %s', $field, implode(', ', $this->getAvailableFields()))); } if (!in_array($order, array('ASC', 'DESC'))...
@param string $field field @param string $order order @return QueryBuilder
entailment
public function paginate($target, $page = 1, $limit = 10, $options = array()) { if (!$target instanceof PagerToken) { throw new \Exception('Not supported, must give a PagerToken'); } $offset = ($page - 1) * $limit; $limit = $limit - 1; // due to redis $ids = $th...
{@inheritdoc}
entailment
public function deploy(ActionInterface $action, ActionManagerInterface $actionManager) { if ($action->getStatusWanted() !== ActionInterface::STATUS_PUBLISHED) { return; } $this->entryCollection->setActionManager($actionManager); $results = $this->processSpreads($action)...
{@inheritdoc}
entailment
public function setDelivery($delivery) { $availableDelivery = array(self::DELIVERY_IMMEDIATE, self::DELIVERY_WAIT); if (!in_array($delivery, $availableDelivery)) { throw new \InvalidArgumentException(sprintf('Delivery "%s" is not supported, (%s)', $delivery, implode(', ', $availableDeli...
{@inheritdoc}
entailment
public function processSpreads(ActionInterface $action) { if ($this->onSubject) { $this->entryCollection->add(new Entry($action->getSubject()), 'GLOBAL'); } foreach ($this->spreads as $spread) { if ($spread->supports($action)) { $spread->process($acti...
@param ActionInterface $action action @return EntryCollection
entailment
public function createQueryBuilderFromArray(array $data, ActionManagerInterface $actionManager = null) { return $this->createQueryBuilder() ->fromArray($data, $actionManager) ; }
@param array $data data @param ActionManagerInterface $actionManager actionManager @return QueryBuilder
entailment
public function addComponent($type, $component, $actionComponentClass) { $actionComponent = new $actionComponentClass(); $actionComponent->setType($type); if ($component instanceof ComponentInterface) { $actionComponent->setComponent($component); } elseif (is_scalar($com...
{@inheritdoc}
entailment
public function hasComponent($type) { foreach ($this->getActionComponents() as $actionComponent) { if ($actionComponent->getType() == $type) { return true; } } return false; }
{@inheritdoc}
entailment
public function getComponent($type) { foreach ($this->getActionComponents() as $actionComponent) { if ($actionComponent->getType() == $type) { return $actionComponent->getText() ?: $actionComponent->getComponent(); } } }
{@inheritdoc}
entailment
public function setStatusCurrent($statusCurrent) { if (!$this->isValidStatus($statusCurrent)) { throw new \InvalidArgumentException(sprintf('Status "%s" is not valid, (%s)', $statusCurrent, implode(', ', $this->getValidStatus()))); } $this->statusCurrent = $statusCurrent; ...
{@inheritdoc}
entailment
public function setStatusWanted($statusWanted) { if (!$this->isValidStatus($statusWanted)) { throw new \InvalidArgumentException(sprintf('Status "%s" is not valid, (%s)', $statusWanted, implode(', ', $this->getValidStatus()))); } $this->statusWanted = $statusWanted; ret...
{@inheritdoc}
entailment
public function addActionComponent(ActionComponentInterface $actionComponent) { $actionComponent->setAction($this); $type = $actionComponent->getType(); foreach ($this->getActionComponents() as $key => $ac) { if ($ac->getType() == $type) { unset($this->actionComp...
{@inheritdoc}
entailment
public function addTimeline(TimelineInterface $timeline) { $timeline->setAction($this); $this->timelines[] = $timeline; return $this; }
{@inheritdoc}
entailment
public function fetch($query, $page = 1, $maxPerPage = 10) { if (!$query instanceof PagerToken) { throw new \Exception('Not supported, must give a PagerToken'); } $offset = ($page - 1) * $maxPerPage; $maxPerPage = $maxPerPage - 1; // due to redis $ids = $this->c...
@param mixed $query query @param int $page page @param int $maxPerPage maxPerPage @throws \Exception @return \Traversable
entailment
public function getTimeline(ComponentInterface $subject, array $options = array()) { $resolver = new OptionsResolver(); $resolver->setDefaults(array( 'page' => 1, 'max_per_page' => 10, 'type' => TimelineInterface::TYPE_TIMELINE, 'contex...
{@inheritdoc}
entailment
public function countKeys(ComponentInterface $subject, array $options = array()) { $resolver = new OptionsResolver(); $resolver->setDefaults(array( 'type' => TimelineInterface::TYPE_TIMELINE, 'context' => 'GLOBAL', )); $options = $resolver->resolve($option...
{@inheritdoc}
entailment
public function remove(ComponentInterface $subject, $actionId, array $options = array()) { $resolver = new OptionsResolver(); $resolver->setDefaults(array( 'type' => TimelineInterface::TYPE_TIMELINE, 'context' => 'GLOBAL', )); $options = $resolver->resolve...
{@inheritdoc}
entailment
public function removeAll(ComponentInterface $subject, array $options = array()) { $resolver = new OptionsResolver(); $resolver->setDefaults(array( 'type' => TimelineInterface::TYPE_TIMELINE, 'context' => 'GLOBAL', )); $options = $resolver->resolve($option...
{@inheritdoc}
entailment
public function createAndPersist(ActionInterface $action, ComponentInterface $subject, $context = 'GLOBAL', $type = TimelineInterface::TYPE_TIMELINE) { $redisKey = $this->getRedisKey($subject, $context, $type); $this->persistedDatas[] = array( 'zAdd', $redisKey, ...
{@inheritdoc}
entailment
public function flush() { if (empty($this->persistedDatas)) { return array(); } $client = $this->client; $replies = array(); if ($this->pipeline) { $client = $client->pipeline(); } foreach ($this->persistedDatas as $persistData) { ...
{@inheritdoc}
entailment
protected function getRedisKey(ComponentInterface $subject, $type, $context) { return sprintf('%s:%s:%s:%s', $this->prefix, $subject->getHash(), $type, $context); }
@param ComponentInterface $subject subject @param string $type type @param string $context context @return string
entailment
protected function _getParentProperties(Statement $sth, $names) { $reflection = new ReflectionObject($sth); $properties = []; foreach ($names as $name) { $property = $reflection->getProperty($name); $property->setAccessible(true); $properties[] = $property...
Yajra's Oci8 "prepare" function returns a Yajra Statement object. But we want an instance of this extended class. To avoid completely re-implementing that "prepare" function just to change one line (and thus also requiring future maintenance), we need to grab the private properties of the Statement object so that we ca...
entailment
public function closeCursor() { if (empty($this->_sth)) { return true; } $success = oci_free_statement($this->_sth); $this->_sth = null; return $success; }
{@inheritDoc}
entailment
public function loadUnawareEntries() { if (!$this->actionManager) { return; } $unawareEntries = array(); foreach ($this->coll as $context => $entries) { foreach ($entries as $entry) { if ($entry instanceof EntryUnaware) { ...
Load unaware entries, instead of having 1 call by entry to fetch component you can add unaware entries. Component will be created or exception will be thrown if it does not exist @throws \Exception @return void
entailment
public function describeForeignKeySql($tableName, $config) { list($table, $schema) = $this->_tableSplit($tableName, $config); if (empty($schema)) { return [ 'SELECT cc.column_name, cc.constraint_name, r.owner AS REFERENCED_OWNER, r.table_name AS REFERENCED_TABLE_NAME, r.c...
{@inheritDoc}
entailment
public function convertColumnDescription(TableSchema $table, $row) { switch ($row['DATA_TYPE']) { case 'DATE': $field = ['type' => 'datetime', 'length' => null]; break; case 'TIMESTAMP': case 'TIMESTAMP(6)': case 'TIMESTAMP(9)':...
{@inheritDoc}
entailment
public function convertIndexDescription(TableSchema $table, $row) { $type = null; $columns = $length = []; $name = $row['CONSTRAINT_NAME']; switch ($row['CONSTRAINT_TYPE']) { case 'P': $name = $type = TableSchema::CONSTRAINT_PRIMARY; break...
{@inheritDoc}
entailment
public function convertForeignKeyDescription(TableSchema $table, $row) { $data = [ 'type' => TableSchema::CONSTRAINT_FOREIGN, 'columns' => [strtolower($row['COLUMN_NAME'])], 'references' => ["{$row['REFERENCED_OWNER']}.{$row['REFERENCED_TABLE_NAME']}", strtolower($row['RE...
{@inheritDoc}
entailment
protected function _tableSplit($tableName, $config) { $schema = null; $table = strtoupper($tableName); if (strpos($tableName, '.') !== false) { $tableSplit = explode('.', $tableName); $table = strtoupper($tableSplit[1]); $schema = strtoupper($tableSplit[0]...
Helper method for generating key SQL snippets. @param string $tableName Table name, possibly including schema @param array $config The connection configuration to use for getting tables from. @return string
entailment
public function columnSql(TableSchema $table, $name) { $data = $table->getColumn($name); if ($this->_driver->isAutoQuotingEnabled()) { $out = $this->_driver->quoteIdentifier($name); } else { $out = $name; } $typeMap = [ 'integer' => ' NUMBE...
{@inheritDoc}
entailment
protected function _keySql($prefix, $data) { $columns = $data['columns']; if ($this->_driver->isAutoQuotingEnabled()) { $columns = array_map( [$this->_driver, 'quoteIdentifier'], $columns ); } if ($data['type'] === TableSchema:...
Helper method for generating key SQL snippets. @param string $prefix The key prefix @param array $data Key data. @return string
entailment
protected function _convertConstraintColumns($references) { if ($this->_driver->isAutoQuotingEnabled()) { if (is_string($references)) { return $this->_driver->quoteIdentifier($references); } return implode(', ', array_map( [$this->_driver,...
{@inheritDoc} Override to only use quoteIdentifier if autoQuoting is enabled
entailment
public function constraintSql(TableSchema $table, $name) { $data = $table->getConstraint($name); if ($this->_driver->isAutoQuotingEnabled()) { $out = 'CONSTRAINT ' . $this->_driver->quoteIdentifier($name); } else { $out = 'CONSTRAINT ' . $name; } if ($...
{@inheritDoc}
entailment
public function createTableSql(TableSchema $table, $columns, $constraints, $indexes) { $content = array_merge($columns, $constraints); $content = implode(",\n", array_filter($content)); $tableName = $table->name(); if ($this->_driver->isAutoQuotingEnabled()) { $tableName ...
{@inheritDoc}
entailment
public function listTablesSql($config) { if ($this->_driver->isAutoQuotingEnabled()) { $column = 'table_name'; } else { $column = 'LOWER(table_name)'; } if (empty($config['schema'])) { return ["SELECT {$column} FROM sys.user_tables", []]; }...
{@inheritDoc}
entailment
public function truncateTableSql(TableSchema $table) { $tableName = $table->name(); if ($this->_driver->isAutoQuotingEnabled()) { $tableName = $this->_driver->quoteIdentifier($tableName); } return [sprintf("TRUNCATE TABLE %s", $tableName)]; }
{@inheritDoc}
entailment
public function addConstraintSql(TableSchema $table) { $sqlPattern = 'ALTER TABLE %s ADD %s;'; $sql = []; foreach ($table->constraints() as $name) { $constraint = $table->getConstraint($name); if ($constraint['type'] === TableSchema::CONSTRAINT_FOREIGN) { ...
{@inheritDoc}
entailment
protected function prepareParsedData(array $matches) { $result = parent::prepareParsedData($matches); if (isset($result['time'])) { $result['time'] = $this->formatTime($result['time']); } if (isset($result['response_body_size']) && $result['response_body_size'] == '-') ...
{@inheritdoc}
entailment
protected function getPattern() { if ($this->pattern !== null) { return $this->pattern; } $this->keyBag = new KeyBag(); $pattern = $this->getQuotedFormatString(); // Put simple patterns $pattern = str_replace( array_keys($this->getSimplePatte...
{@inheritdoc}
entailment
protected function getQuotedFormatString() { // Valid pattern of log format directives $validPattern = '%(\!?[2-5]\d\d(\,[2-5]\d\d)*)?(\<|\>)?(\{[^\}]*\})?[a-z]'; $pattern = preg_replace_callback( '/(?<before>' . $validPattern . '?)?(?<match>.+?)(?<after>' . $validPattern . ')?/...
Quotes characters which are not included in log format directives and returns quoted format string. @return string
entailment
protected function getCallbackPatterns() { $holder = $this->keyBag; return [ // Header lines in the request sent to the server (e.g., User-Agent, Referer) '/%\{([^\}]+)\}i/' => function (array $matches) use ($holder) { $index = $holder->add('request_headers',...
Patterns that requires preg_replace_callback() to be set in place. @return array
entailment