Spot\Query::first PHP 메소드

first() 공개 메소드

Return the first entity matched by the query
public first ( ) : mixed
리턴 mixed Spot_Entity on success, boolean false on failure
    public function first()
    {
        $result = $this->limit(1)->execute();
        return $result !== false ? $result->first() : false;
    }

Usage Example

예제 #1
0
파일: HasOne.php 프로젝트: brandonlamb/spot
 /**
  * Get the relation entity
  * @return \Spot\Entity\EntityInterface
  */
 public function entity()
 {
     if (null === $this->entity) {
         $this->entity = $this->execute();
         if ($this->entity instanceof Query) {
             $this->entity = $this->entity->first();
         } else {
             if ($this->entity instanceof ResultsetInterface) {
                 $this->entity = $this->entity->first();
             }
         }
     }
     return $this->entity;
 }