for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright Copyright (c) Flipbox Digital Limited
* @license https://github.com/flipbox/spark/blob/master/LICENSE
* @link https://github.com/flipbox/spark
*/
namespace flipbox\spark\services;
use craft\base\ElementInterface;
* @author Flipbox Factory <[email protected]>
* @since 1.0.0
abstract class ElementByString extends Element
{
use traits\ElementByString;
/*******************************************
* FIND
*******************************************/
* @inheritdoc
public function find($identifier, int $siteId = null)
if ($model = parent::find($identifier, $siteId)) {
return $model;
}
if (!is_string($identifier)) {
return null;
return $this->findByString($identifier, $siteId);
public function findCache($identifier, int $siteId = null)
if ($model = parent::findCache($identifier)) {
return $this->findCacheByString($identifier);
public function addToCache(ElementInterface $element)
parent::addToCache($element);
$this->cacheByString($element);
return $this;