public function generate($count)
    {
        if (!is_int($count) || $count < 1) {
            throw new \InvalidArgumentException(sprintf('%s requires a value greater than 1.', __METHOD__));
        }

        $ownerIds = $this->getValidOwnerIds();

        for ($i = 0; $i < $count; $i++) {
            /** @var Entity\Content $entity */
            $entity = $this->repository->create([
                'datecreated'   => date('Y-m-d H:i:s', time() - rand(0, 365 * 24 * 60 * 60)),
                'datepublish'   => date('Y-m-d H:i:s', time() - rand(0, 365 * 24 * 60 * 60)),
                'datedepublish' => null,
                'status'        => 'published',
            ]);
            $ownerKey = array_rand($ownerIds, 1);
            $entity->setOwnerid($ownerIds[$ownerKey]);

            $this->fillEntity($entity);
        }
        $summary = $this->createSummary;
        $this->createSummary = null;

        return $summary;
    }
public function generate($count)
    {
        if (!is_int($count) || $count < 1) {
            throw new \InvalidArgumentException(sprintf('%s requires a value greater than 1.', __METHOD__));
        }

        $ownerIds = $this->getValidOwnerIds();

        for ($i = 0; $i < $count; $i++) {
            /** @var Entity\Content $entity */
            $entity = $this->repository->create([
                'datecreated'   => date('Y-m-d H:i:s', time() - rand(0, 365 * 24 * 60 * 60)),
                'datepublish'   => date('Y-m-d H:i:s', time() - rand(0, 365 * 24 * 60 * 60)),
                'datedepublish' => null,
                'status'        => 'published',
            ]);
            $ownerKey = array_rand($ownerIds, 1);
            $entity->setOwnerid($ownerIds[$ownerKey]);

            $this->fillEntity($entity);
        }
        $summary = $this->createSummary;
        $this->createSummary = null;

        return $summary;
    }
public function generate ( $ count ) { if ( ! is_int ( $ count ) || $ count < 1 ) { throw new \ InvalidArgumentException ( sprintf ( '%s requires a value greater than 1.' , __METHOD__ ) ) ; } $ ownerIds = $ this -> getValidOwnerIds ( ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { /** @var Entity\Content $entity */ $ entity = $ this -> repository -> create ( [ 'datecreated' => date ( 'Y-m-d H:i:s' , time ( ) - rand ( 0 , 365 * 24 * 60 * 60 ) ) , 'datepublish' => date ( 'Y-m-d H:i:s' , time ( ) - rand ( 0 , 365 * 24 * 60 * 60 ) ) , 'datedepublish' => null , 'status' => 'published' , ] ) ; $ ownerKey = array_rand ( $ ownerIds , 1 ) ; $ entity -> setOwnerid ( $ ownerIds [ $ ownerKey ] ) ; $ this -> fillEntity ( $ entity ) ; } $ summary = $ this -> createSummary ; $ this -> createSummary = null ; return $ summary ; }
Generate 'n' number of dummy records.

@param int $count

@return array
Generate n number of dummy records .