本文整理汇总了PHP中type::find方法的典型用法代码示例。如果您正苦于以下问题:PHP type::find方法的具体用法?PHP type::find怎么用?PHP type::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类type
的用法示例。
在下文中一共展示了type::find方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
*
* @param type $id
* @return type
*/
public function show($id)
{
try {
return $this->repository->find($id);
} catch (\Exception $e) {
return ['error' => 'true', 'messege' => "Usuário não encontrado!"];
}
}
示例2: checkWalletDefault
/**
* check exist wallet with user id
* @param type $wallet
* @param type $userId
* @return boolean
*/
public function checkWalletDefault($wallet, $userId)
{
$data = $wallet->find()->where(['user_id' => $userId])->toArray();
if (count($data) == 0) {
return true;
}
return false;
}
示例3: viewAll
/**
* @desc This method display whole list of customers
* @param type $controller This is controller objict
* @param type isPaginate True/False
* @return Return detail list of customer array
*/
function viewAll($controller, $isPaginate = false)
{
if ($isPaginate) {
$data = $controller->paginate('User');
} else {
$data = $controller->find("all");
}
return $data;
}
示例4: _getUsermetas
/**
* _getUsermetas
*
* Returns the metadata from the selected user.
* Use the first parameter for the id.
* If it's empty it returns the logged in users metadata.
*
* @param mixed int|void $id ID of the user
* @param array $options Options.
* @return \Cake\ORM\Entity
*/
protected function _getUsermetas($id = null, $options = [])
{
$_options = ['autoCreate' => true];
$options = array_merge($_options, $options);
if (!$id) {
$id = $this->Controller->request->Session()->read($this->config('userId'));
}
$data = $this->Usermetas->find()->where(['user_id' => $id]);
if ($data->Count() > 0) {
return $data->first();
}
$generated = null;
if ($options['autoCreate']) {
$generated = $this->_createUsermetas($id);
}
return $generated;
}
示例5: consultaInmuebles
/**
*
* @param type $numPage
* @param type $query
* @return type
*/
public static function consultaInmuebles($numPage, $query)
{
$limite = $numPage * 10;
$inicio = $limite - 10;
$json = array();
$jsonArray = array();
$query->limit($limite);
$resultado = $query->find();
for ($i = $inicio; $i < count($resultado); $i++) {
$inmueble = $resultado[$i];
$id = $inmueble->getObjectId();
$descripcion = $inmueble->get('descripcion');
$precio = $inmueble->get('precio');
$json['id'] = $id;
$urlImg = APIInmueble::urlImagen($query);
$json['descripcion'] = $descripcion;
$json['precio'] = $precio;
$json['url'] = $urlImg;
$jsonArray[$i] = $json;
}
return $jsonArray;
}
示例6: parse_topseller
/**
*
* @param type $con
* @return boolean
*
*
*
*
*
*/
protected function parse_topseller($con, $from)
{
if (!$con) {
return false;
}
$this->position = 1;
$a = $con->find('a');
for ($i = 0; $i < count($a); $i++) {
$link = $a[$i]->getAttribute('href');
$first = strpos($link, '.de/') + 4;
$fl = substr($link, $first);
$pzn = $this->strict_numbers(substr($fl, 0, strpos($fl, '/')));
if (in_array($pzn, $this->pzn, TRUE)) {
if ($this->save_links) {
$this->mysql->insert_links(self::ID, $link, $this->position, $from);
}
$this->products_url[] = ['link' => $link, 'position' => $this->position, 'kws' => '', 'from' => $from];
// var_dump($link);
}
++$this->position;
}
}
示例7: find
/**
*
* @param type $id
* @return type
*/
public function find($id)
{
$result = $this->cbo->find($id);
return $result;
}
示例8: clearHTML
/**
* 清理无用HTML
* @param type $domContent
*/
private function clearHTML($domContent)
{
//清理隐藏的HTML
$dom_hiddens = $domContent->find('[style^=display]');
foreach ($dom_hiddens as $dom_hidden) {
$dom_hidden->outertext = '';
}
//清理内容部分图片以防重复
$dom_imgs = $domContent->find('img[src^=uploadpic]');
foreach ($dom_imgs as $dom_img) {
$dom_img->outertext = '';
}
//描述标记
$dom_h3s = $domContent->find('h3');
foreach ($dom_h3s as $dom_h3) {
if (mb_substr($dom_h3->innertext, 0, 2, 'utf-8') == '描述') {
$dom_h3->outertext = '';
continue;
}
if (mb_substr($dom_h3->innertext, 0, 2, 'utf-8') == '地图') {
$dom_h3->next_sibling()->outertext = '';
$dom_h3->outertext = '';
continue;
}
if (mb_substr($dom_h3->innertext, 0, 2, 'utf-8') == '图片') {
$dom_h3->outertext = '';
continue;
}
}
//附加信息
$dom_mt = $domContent->find('p.mt', 0);
$dom_mt->outertext = '';
}
示例9: getProductSpecs
/**
* Metoda pobiera specyfikacje produktu
* @param type $element simple_html_dom fragment strony
* @return type json specyfikacja produktu
*/
public function getProductSpecs($element)
{
$specs = array();
$i = 0;
foreach ($element->find(".specs-group") as $spec) {
if (is_object($spec->find(".section-header h3", 0))) {
$specs[$i]["name"] = $spec->find(".section-header h3", 0)->text();
}
$specs[$i]["specs"] = array();
$j = 0;
foreach ($spec->find("table tr") as $row) {
if (is_object($row->find("th", 0))) {
$specs[$i]["specs"][$j][] = $row->find("th", 0)->text();
}
if (is_object($row->find("td", 0))) {
$specs[$i]["specs"][$j][] = $row->find("td", 0)->text();
} else {
if (count($row->find("td ul li")) > 0) {
$attrs = array();
foreach ($row->find("td ul li") as $attr) {
if (is_object($attr->find("a", 0))) {
$attrs[] = $attr->find("a", 0)->text();
} else {
$attrs[] = $attr->text();
}
}
$specs[$i]["specs"][$j][] = implode(",", $attrs);
}
}
$j++;
}
$i++;
}
return json_encode($specs);
}
示例10: getAccount
/**
* get account by email
* @param type $user
* @param type $email
* @return type
*/
public function getAccount($user, $email)
{
return $user->find()->where(['email' => $email])->first();
}
示例11: find
/**
* @param $entity
* @param $id
* @return mixed
*/
public function find($entity, $id)
{
$result = $this->dao->find($entity, $id);
return $result;
}
示例12: _getNextMenuOrder
/**
* This function provide the next menu order value for related Content.
*
* @param type $parent
* @param type $content_type
* @return int
*/
protected function _getNextMenuOrder($parent_id, $cms_content_type_id)
{
return $this->Table->find('all')->where(['parent_id' => $parent_id, 'cms_content_type_id' => $cms_content_type_id])->order(['menu_order' => 'DESC'])->count() + 1;
}
示例13: index
/**
* Retrieve the list of Content, and loads the template for the view in list.
*/
public function index()
{
$this->set('data', $this->Content->find(['type_id' => $this->type_id, 'limit' => $this->limit]));
$this->set('_serialize', ['data']);
}
示例14: getUsefullnes
/**
* Metoda pobiera informacje o użyteczności recenzji
* @param type $element simple_html_dom fragment strony
* @param type $i int index elementu
* @return type array tablica z informacją o użyteczności recenzji
*/
public function getUsefullnes($element, $i)
{
$rate = $element->find(".rate-count", $i);
$rate_count = $rate->find("strong", 0)->text();
$rate_positive = $rate->find("strong", 1)->text();
$rate_positive = str_replace("%", "", $rate_positive);
$comment_rate = array();
$comment_rate[0] = round($rate_count * $rate_positive / 100);
$comment_rate[1] = round($rate_count - $comment_rate[0]);
return $comment_rate;
}