Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Really Confused Over Error $This->

$
0
0
I just received this error from some code I was testing

SiteController and its behaviors do not have a method or closure named "create_entity".

The call to $this->create_entity() occurs no less than 6 times in the code and runs fine up to the last segment.

I had my code blocked out and was testing it one step at a time.

Why would one reference to $this->create_entity() work and the next fail?

 --  THIS WORKS FINE....!!!
	$width = 160;
	$height = 600;
	$size_id = $width.'x'.$height ;
		
	//check for existance of this size
	$criteria = new CDbCriteria;
	$criteria->condition = 'website_id='.$site_id.' and size_id="'.$size_id.'"';
	$placement = Placement::model()->find($criteria);
	if (empty($placement)) {  // create placement
		$created = $created + 1;
		 $name = $site->site_url.' : ROS : '.$width.'x'.$height.' : '.$position ;
		 // Get AppNexus ID for Placement  
		 $appnexus_id = $this->createApPlacement($auth, $site->appnexus_id, $width, $height, $name);
		 $status = $this->createPlacement( $site->publisher_id, $site->id, $width, $height, $appnexus_id, $name, $product );
	} 
	$criteria = new CDbCriteria;
	$criteria->condition = 'website_id='.$site_id.' and tag_type="preroll" ';
	$placement = Tag::model()->find($criteria);
	if (empty($placement)) {  	
	$created = $created + 1;
	$entity = $this->create_entity($this->publisher_id, $url);
	$success = $this->createTag($entity, $site->site_url.' - Pre-Roll', $site->publisher_id, $site->id, null, 'preroll', 0);
	}

	
	$criteria = new CDbCriteria;
	$criteria->condition = 'website_id='.$site_id.' and tag_type="mobile" ';
	$placement = Tag::model()->find($criteria);
	if (empty($placement)) {  
	$created = $created + 1;
	$entity = $this->create_entity($this->publisher_id, $url);
	$success = $this->createTag($entity, $site->site_url.' - Mobile', $site->publisher_id, $site->id, null, 'mobile', 0);
	}

	$width = "0";	 
	$height = "0";
	$size_id = $width.'x'.$height ;
	$product = 6;
	$criteria = new CDbCriteria;
	$criteria->condition = 'website_id='.$site_id.' and product = 6 ';
	$placement = Placement::model()->find($criteria);
	if (empty($placement)) {  
		$created = $created + 1;
		$name = $site->site_url.' : Impact : Sizeless : '.$position ;

[b]// THIS FAILS !!  Same call !
		$app_id = $this->createApPlacement($auth, $site->app_id, $width, $height, $name);
		$status = $this->createPlacement( $site->publisher_id, $site->id, $width, $height, $app_id, $name, $product ) ;
		
		$entity = $this->create_entity($site->publisher_id, $site->site_url);
		$success = $this->createTag($entity, $site->site_url.' - Impact', $site->publisher_id, $site->id, $app_id, 'vslider_impact', 1);[/b]

	} // end create placement


This code is in my Model Approval.php --- suddenly the $this-> refers to the controller ? Midway thru the logic?

Makes no sense!

Viewing all articles
Browse latest Browse all 18717

Trending Articles