Finds recepts

@param Pluf_Model $owner
@param integer $ownerId
976419
public static function find($owner, $ownerId = null)
    {
        // get class
        if ($owner instanceof Pluf_Model) { // Pluf module
            $ownerClass = $owner->getClass();
            $ownerId = $owner->getId();
        } elseif (! is_null($owner)) { // module
            $ownerClass = $owner;
        }

        // get list
        $receipt = new Bank_Receipt();
        $q = new Pluf_SQL('owner_class=%s AND owner_id=%s', array(
            $ownerClass,
            $ownerId
        ));
        $list = $receipt->getList(array(
            'filter' => $q->gen()
        ));
        return $list;
    }
774678
protected function serializeHasOne(Model $owner, Model $model = null, AdapterInterface $adapter)
    {
        return $this->serialize($model, $adapter);
    }
1036254
public function sync(ARef $ref, OwnField $own)
    {
        $ownerType = $ref->getType();
        $owner_type_name = $ownerType->getName();
        $own_name = $own->getName();
        $id = $ref->getId();
        $field_type_name = $own->getFieldTypeName();

        if($field_type_name === 'int')
        {
            $model = IntModel::where('entity_name', '=', $owner_type_name)->where('entity_id', '=', $id)->where('name', '=', $own_name)->first();
        }
        elseif($field_type_name === 'timestamp')
        {
            $model = TimestampModel::where('entity_name', '=', $owner_type_name)->where('entity_id', '=', $id)->where('name', '=', $own_name)->first();
        }
        elseif($field_type_name === 'string')
        {
            $model = StringModel::where('entity_name', '=', $owner_type_name)->where('entity_id', '=', $id)->where('name', '=', $own_name)->first();
        }
        elseif($field_type_name === 'text')
        {
            $model = TextModel::where('entity_name', '=', $owner_type_name)->where('entity_id', '=', $id)->where('name', '=', $own_name)->first();
        }
        elseif($field_type_name === 'float')
        {
            $model = FloatModel::where('entity_name', '=', $owner_type_name)->where('entity_id', '=', $id)->where('name', '=', $own_name)->first();
        }
        elseif($field_type_name === 'bool')
        {
            $model = BoolModel::where('entity_name', '=', $owner_type_name)->where('entity_id', '=', $id)->where('name', '=', $own_name)->first();
        }
        else
        {
            throw new SyncException('Scalar синхронизатор не обрабатывает тип '.$field_type_name);
        }

        if(!$model)
        {
            if($field_type_name === 'int')
            {
                IntModel::create(['entity_name' => $owner_type_name, 'entity_id' => $id, 'name' => $own_name, 'value' => 0]);
            }
            elseif($field_type_name === 'timestamp')
            {
                TimestampModel::create(['entity_name' => $owner_type_name, 'entity_id' => $id, 'name' => $own_name, 'value' => time()]);
            }
            elseif($field_type_name === 'string')
            {
                StringModel::create(['entity_name' => $owner_type_name, 'entity_id' => $id, 'name' => $own_name, 'value' => '']);
            }
            elseif($field_type_name === 'text')
            {
                TextModel::create(['entity_name' => $owner_type_name, 'entity_id' => $id, 'name' => $own_name, 'value' => '']);
            }
            elseif($field_type_name === 'float')
            {
                FloatModel::create(['entity_name' => $owner_type_name, 'entity_id' => $id, 'name' => $own_name, 'value' => 0]);
            }
            elseif($field_type_name === 'bool')
            {
                BoolModel::create(['entity_name' => $owner_type_name, 'entity_id' => $id, 'name' => $own_name, 'value' => false]);
            }
        }
    }
191475
public function tocAction($owner, $ownerId)
    {
        /** @var BlockProviderInterface $provider */
        $provider = $this->get('opifer.content.block_provider_pool')->getProvider($owner);
        $object = $provider->getBlockOwner($ownerId);

        /** @var Environment $environment */
        $environment = $this->get('opifer.content.block_environment');
        $environment->setDraft(true)->setObject($object);
        $environment->setBlockMode('manage');

        $twigAnalyzer = $this->get('opifer.content.twig_analyzer');

        $parameters = [
            'environment' => $environment,
            'analyzer' => $twigAnalyzer,
            'object' => $environment->getObject(),
        ];

        return $this->render('OpiferContentBundle:Content:toc.html.twig', $parameters);
    }
912930
protected static function fetch_subtypes($ownerdir) {
        global $CFG;

        $types = array();
        if (file_exists("$ownerdir/db/subplugins.php")) {
            $subplugins = array();
            include("$ownerdir/db/subplugins.php");
            foreach ($subplugins as $subtype => $dir) {
                if (!preg_match('/^[a-z][a-z0-9]*$/', $subtype)) {
                    error_log("Invalid subtype '$subtype'' detected in '$ownerdir', invalid characters present.");
                    continue;
                }
                if (isset(self::$subsystems[$subtype])) {
                    error_log("Invalid subtype '$subtype'' detected in '$ownerdir', duplicates core subsystem.");
                    continue;
                }
                if ($CFG->admin !== 'admin' and strpos($dir, 'admin/') === 0) {
                    $dir = preg_replace('|^admin/|', "$CFG->admin/", $dir);
                }
                if (!is_dir("$CFG->dirroot/$dir")) {
                    error_log("Invalid subtype directory '$dir' detected in '$ownerdir'.");
                    continue;
                }
                $types[$subtype] = "$CFG->dirroot/$dir";
            }
        }
        return $types;
    }
477195
public function setOwnerSide($ownerSide)
    {
        if (!is_bool($ownerSide)) {
            throw new \InvalidArgumentException('The attribute ownerSide on the class Attribute has to be boolean (' . gettype($ownerSide) . ('object' === gettype($ownerSide) ? ' ' . get_class($ownerSide) : '') . ' given).');
        }

        $this->ownerSide = $ownerSide;

        return $this;
    }
693135
public function saveField (MapField $field, ElementInterface $owner)
	{
		if ($owner instanceof MapElement)
			return;

		/** @var MapElement $map */
		$map = $owner->getFieldValue($field->handle);

		$map->fieldId     = $field->id;
		$map->ownerId     = $owner->id;
		$map->ownerSiteId = $owner->siteId;

		\Craft::$app->elements->saveElement($map, true, true);
	}
951961
public function linkRelations($owner, $repo, $state = null, $head = null, $base = null)
	{
		return $this->listPullRequests( $owner, $repo, $state, $head, $base );
	}
198717
public function scopeWhereNotOwnedBy(Builder $query, CanBeOwnerContract $owner)
    {
        return $query->where(function (Builder $q) use ($owner) {
            $q->where('owned_by_id', '!=', $owner->getKey())
                ->orWhere('owned_by_type', '!=', $owner->getMorphClass());
        });
    }
210532
public function historyAction(Request $request, $owner, $id)
    {
        $this->getDoctrine()->getManager()->getFilters()->disable('draft');

        /** @var Environment $environment */
        $environment = $this->get('opifer.content.block_environment');
        $environment->load($owner, $id);
        $environment->setBlockMode('manage');

        /** @var AbstractDesignSuite $suite */
        $suite = $this->get(sprintf('opifer.content.%s_design_suite', $owner));
        $suite->load($id);

        return $this->render($this->getParameter('opifer_content.content_history_view'), [
            'environment' => $environment,
            'suite' => $suite,
        ]);
    }
1296242
public static function notAllowed(OwnableContract $ownable, CanBeOwnerContract $owner)
    {
        return new static(sprintf('Model `%s` not allows owner of type `%s`.', get_class($ownable), get_class($owner)));
    }
1354673
public function newAuthorizeRequest($owner, $owner_id, $options)
  {
    return $this->authServer->getGrantType('authorization_code')->newAuthoriseRequest($owner, $owner_id, $options);
  }
145590
public function watch($owner, $repo)
	{
		// Build the request path.
		$path = '/user/subscriptions/' . $owner . '/' . $repo;

		return $this->processResponse(
			$this->client->put($this->fetchUrl($path), ''),
			204
		);
	}
689643
public function isOwnedBy(CanBeOwnerContract $owner)
    {
        if (!$this->hasOwner()) {
            return false;
        }

        return $owner->getKey() === $this->getOwner()->getKey();
    }
867754
public function exists($owner, $type = 'default')
    {
        $owner_id = spl_object_id($owner);
        return isset($this->_pool[$owner_id][$type]);
    }
55789
public function setOwner(HTML_QuickForm2_Node $owner)
    {
        if (null !== $this->owner) {
            $this->owner->removeRule($this);
        }
        $this->owner = $owner;
    }
881018
public function newAuthorizeRequest($owner, $owner_id, $options)
  {
    return $this->getOAuth()->getAuthServer()
          ->getGrantType('authorization_code')
          ->newAuthoriseRequest($owner, $owner_id, $options);
  }